bdawg.io
10/30/2018, 12:14 AMawait
on an async
job, you might as well just use withContext
Rohit Surwase
10/30/2018, 4:12 AMHandlerThread + Looper
? I tried and it worked for limited use case but not sure about generic use case. I feel it is not a good practice and will not work for all cases? Is it?Paul Woitaschek
10/30/2018, 7:06 AMPaul Woitaschek
10/30/2018, 7:07 AMuhe
10/30/2018, 12:34 PMproduce
, UNDISPATCHED
, etc). According to the docs I can opt in via "the compiler argument -Xuse-experimental=kotlin.Experimental" but I can't for the life of me figure out how to specify this in my gradle files.
I tried adding this to my root build.gradle, but it's not working:
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += [
'-Xuse-experimental=kotlin.Experimental'
]
}
}
Does anybody know how I can opt-in properly?Albert
10/30/2018, 2:01 PMactor
properly? I tried:
GlobalScope.actor { }
But it is annotated with ObsoleteCoroutinesApi
Jonathan
10/30/2018, 4:20 PMonCompletion
argument of produce
is marked internal api, and it is not possible to CoroutineStart.ATOMIC
with produce
, how can one make sure a given resource is always released?Paul Woitaschek
10/30/2018, 9:03 PMPaul Woitaschek
10/30/2018, 9:17 PMgroostav
10/30/2018, 11:06 PMk-grpc
? grpc-k-extensions
?), my first implementation looked like thiskevinherron
10/30/2018, 11:37 PMibash
10/31/2018, 6:34 AMHarun
10/31/2018, 10:34 AMdave08
10/31/2018, 1:38 PMvar currWork: Job = null
launch { if (cancelCurrWork) currWork?.cancel() }
currWork = doWork()
?louiscad
10/31/2018, 3:00 PMwithContext
doesn't throw any CancellationException
before running the passed block even if the context is cancelled.
I thought it checked before, and after running the passed block.
Is this an intentional change, a doc misreading or a misunderstanding of the source code from me?deviant
10/31/2018, 3:18 PMcompileKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi']
}
}
hmole
10/31/2018, 3:51 PMzip
) with coroutines. Api calls are Deferred<T>
with retrofit-coroutines-adapter
. But they don't seem to execute in parallel. What am I doing wrong?christophsturm
10/31/2018, 6:05 PMFelix
10/31/2018, 9:00 PMCoroutineScope(coroutineContext).launch {...}
.
1) Is there a better way?
2) Is this a bad practice?Felix
10/31/2018, 9:09 PMcoroutineScope{ launch {...} launch {...}}
. However, coroutineScope
suspends until all the children coroutines are completed. Probably most of the times this is a good thing, however there may be situations where I want to continue without waiting for the child coroutines to end.tuan.lam
11/01/2018, 7:40 AMKulwinder Singh
11/01/2018, 8:18 AMlaunch
builder but now inside this builder i'm confused with async
, withContext
and coroutineScope
like what is best for which situation? can please anybody tell me when to use one of them inside launch
?Paul Woitaschek
11/01/2018, 8:30 AMjulioyg
11/01/2018, 8:48 AMMark Gilchrist
11/01/2018, 10:02 AMMark Gilchrist
11/01/2018, 10:04 AMMark
11/01/2018, 12:22 PMproduce{}
for a finite sequence of items, the docs say to call SendChannel.close()
to indicate no more items will be sent. But isn’t the common case for no more items to be sent once produce
lambda has completed naturally? In which case, why is SendChannel.close()
not done automatically?Jonathan
11/01/2018, 1:36 PMReceiveChannel.toSet()
and ReceiveChannel.toMap()
are ObsoleteCoroutinesApi
but ReceiveChannel.toList()
is not?rocketraman
11/01/2018, 5:03 PMrocketraman
11/01/2018, 5:07 PMCoroutineScope.writer
et al in <http://kotlinx.coroutines.io|kotlinx.coroutines.io>
take a coroutineContext
? Can't it get it from the receiver CoroutineScope
?rocketraman
11/01/2018, 5:07 PMCoroutineScope.writer
et al in <http://kotlinx.coroutines.io|kotlinx.coroutines.io>
take a coroutineContext
? Can't it get it from the receiver CoroutineScope
?Zach Klippenstein (he/him) [MOD]
11/01/2018, 6:33 PMrocketraman
11/02/2018, 6:21 AM