jimn
08/11/2017, 3:22 AMgildor
08/11/2017, 4:59 AMjulienviet
08/11/2017, 3:21 PMjimn
08/12/2017, 7:06 AMjulienviet
08/14/2017, 10:23 AMjimn
08/14/2017, 7:02 PMwouterdoeland
08/20/2017, 11:55 AM<http://logger.info|logger.info>("command = start")
launch(CommonPool) {
<http://logger.info|logger.info>("in pool for start")
I get the in pool for start
message minutes later than command = start
message.
Am I not using coroutines correctly? I am running a lot of stuff in these launch(CommonPool) blocks.ersin_ertan
08/20/2017, 8:01 PMalband
08/21/2017, 8:27 AMjimn
08/23/2017, 3:15 AMval terminal = any_of(seq(singleQuote, character, repeating(character), singleQuote), seq(doubleQuote, character, repeating(character), doubleQuote))
... and then wrap coroutines around the ctor params which are themselves functions which should be coroutines....johannes.lagos
08/23/2017, 7:18 AMawait()
on my coroutine doesn't wait to be done before it continue.julienviet
08/24/2017, 11:27 AMxanderblinov
08/26/2017, 2:03 PMxanderblinov
08/26/2017, 2:42 PMtrubesv
08/26/2017, 7:15 PMCoroutine
that is inside a custom ViewHolder
The function is not recognised, and when I put it in the ViewHolder
class, of course I can't calll the `add`/`remove` functions anymore..
Could you point me in the right direction please?
Here is the basic setup:
class MyAdapter() : RecyclerView.Adapter<MyViewHolder>()
{
fun add() {}
fun remove() {}
[...]
/* Custom ViewHolder */
class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
{
fun bind(item: Item) = with(itemView)
{
/* Handle long click event on row*/
isLongClickable = true
onLongClick { function() } // I'M HAVING TROUBLE HERE (Unresolved reference)
[...]
}
}
/* How to call this? */
fun function() {
add()
remove()
}
Thanks for the help! 🙂dragas
08/28/2017, 12:56 PMCommonPool
even after it has called close()
on itself?
For example
fun doThings() : ProducerJob<Foo> = produce(CommonPool)
{
println("I am do things!")
delay(1000)
send(Foo())
close()
}
benfleis
08/28/2017, 7:20 PMbenfleis
08/29/2017, 7:32 AMelizarov
08/29/2017, 2:53 PManthonyeef
08/30/2017, 8:18 AMasync(UI) {
val fetchDataJob = bg {
ColumnRepo.getFromRemote(22352581)
}
val data = fetchDataJob.await()
info(data.id.toString())
if (fetchDataJob.isCompletedExceptionally) {
doSomeThingWithException(fetchDataJob.getCompletionException())
}
}
gildor
08/30/2017, 8:27 AMfetchDataJob.await()
to try/catch. If await fails (and will throw exception) your fetchDataJob.isCompletedExceptionally
never be reachedDalinar
08/31/2017, 1:47 AMelizarov
08/31/2017, 12:45 PMandreasmattsson
09/01/2017, 8:31 AMlibrary.invoke(arg) { value -> doSomething(value) }
Now what I'd like to do is wrap this somehow so that instead of using a callback my wrapping method returns a Sequence (going from a push to a pull style API).
My first attempt was to use buildSequence:
buildSequence { library.invoke(arg) { value -> yield(value) } }
But this gives Suspension functions can be called only within coroutine body
.
The Wrapping callbacks section in the documentation here looked promising:
https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#wrapping-callbacks
But as far as I can tell this suspendCoroutine
trick only works if the callback is called only once by the library. Mine is called many many times, and I want to have a sequence where I can consume items one by one and not have to gather them in a list first.
Channels looks like a good approach but AFAIK they are only available in the kotlinx.coroutines
package that does not work in Kotlin Native.
Any suggestions? Are there any "out of the box" or idiomatic solutions for this that don't involve manually implementing a producer/consumer pattern using C/threading concurrency stuff?pakoito
09/03/2017, 5:44 PMjw
09/05/2017, 3:33 PMThread.sleep
though, so...kenkyee
09/05/2017, 7:21 PMqwert_ukg
09/06/2017, 3:00 AMpakoito
09/06/2017, 8:56 AMelizarov
09/06/2017, 12:18 PMdevelop
branch. There are byte channels for suspendable reading/writing and later we’ll publish the whole sockets & http stack based on that.elizarov
09/06/2017, 12:18 PMdevelop
branch. There are byte channels for suspendable reading/writing and later we’ll publish the whole sockets & http stack based on that.julienviet
09/06/2017, 12:33 PMelizarov
09/06/2017, 3:51 PMjkbbwr
09/07/2017, 10:25 AMchristophsturm
09/07/2017, 11:14 AMelizarov
09/07/2017, 11:22 AMchristophsturm
09/07/2017, 11:32 AMelizarov
09/07/2017, 1:09 PM