jw
01/19/2018, 4:56 AMmutex
that I can see. Haven't used that beforebj0
01/19/2018, 5:29 AMjw
01/19/2018, 5:43 AMbj0
01/19/2018, 6:10 AMbj0
01/19/2018, 6:12 AMdave08
01/19/2018, 6:19 AMcoroutineContext
, that could maybe do it...bj0
01/19/2018, 6:20 AMwhile(true) {
if( currentJob == null )
break
currentJob.join()
}
currentJob = launch { ... }
bj0
01/19/2018, 6:21 AMcurrentJob.join(); currentJob = null
at the end, or at the end of the launchbj0
01/19/2018, 6:21 AMdave08
01/19/2018, 6:21 AMjw
01/19/2018, 6:23 AMprivate var runningJob: Job? = null
private val queuedJobs = mutableListOf<Job>()
jw
01/19/2018, 6:23 AMbj0
01/19/2018, 6:33 AMbj0
01/19/2018, 6:33 AMsuspend fun
dominik.sittel
01/19/2018, 7:07 AMdominik.sittel
01/19/2018, 7:07 AMdave08
01/19/2018, 7:18 AMlouiscad
01/19/2018, 1:26 PMasync
block launched within launch
execute in another coroutine Context (e.g. CommonPool
), while being a child of the coroutine launched with launch
? My goal is to cancel the async
block if the launch
block is cancelled.antifaton
01/19/2018, 2:03 PMasync
as in launch
louiscad
01/19/2018, 2:28 PMasync
as a child of launch
, while having them execute in different dispatchers. I tried using async(coroutineContext + CommonPool) { ... }
and it seems to work (my code is a bit complex to be sure at the moment)elizarov
01/19/2018, 3:27 PMelizarov
01/19/2018, 3:28 PMasync(CommonPool, parent = coroutineContext[Job])
elizarov
01/19/2018, 3:28 PMlouiscad
01/19/2018, 3:34 PMelizarov
01/19/2018, 3:58 PMJob
, CoroutineDispatcher
, and an optional CoroutineName
and CoroutineId
to be used for debugging. Everything else == custom stuff that you might have to keep your app-specific “coroutine-local” variables.louiscad
01/19/2018, 4:00 PMCoroutineExceptionHandler
that could be part of a coroutine Context. How can I use this?louiscad
01/19/2018, 4:01 PMJob
that would allow me to catch exceptions that may happen in the launch
blocklouiscad
01/19/2018, 4:02 PMCoroutineScope
as its receiver?louiscad
01/19/2018, 4:05 PMelizarov
01/19/2018, 4:05 PMCoroutineExceptionHandler
also