Luis Munoz
08/01/2019, 8:25 PMgroostav
08/01/2019, 8:26 PMupdate()Luis Munoz
08/01/2019, 8:26 PMLuis Munoz
08/01/2019, 8:27 PMLuis Munoz
08/01/2019, 8:27 PMDominaezzz
08/01/2019, 8:27 PMMutexgroostav
08/01/2019, 8:28 PMclass Example : CoroutineScope {
  //extending coroutine scope doesnt get you anything implicitly. It does make `launch()` and `async` et all easier to use
  val mutex = Mutex()
  suspend fun update() {
    mutex.withLock {
      count++
    }
  }
}Luis Munoz
08/01/2019, 8:28 PMgroostav
08/01/2019, 8:28 PMDispatchers.MainDispatchers.JavaFxsuspend fun update() = withContext(this.coroutineContext){
  count++
}Luis Munoz
08/01/2019, 8:29 PMgroostav
08/01/2019, 8:30 PMLuis Munoz
08/01/2019, 8:31 PMDominaezzz
08/01/2019, 8:31 PMgroostav
08/01/2019, 8:31 PMDispatchers.Defaultupdate()groostav
08/01/2019, 8:34 PMLuis Munoz
08/01/2019, 8:34 PMgroostav
08/01/2019, 8:35 PMmutex.withLock { mutex.withLock {}}Luis Munoz
08/01/2019, 8:38 PMgroostav
08/01/2019, 8:40 PMExecutors.newSingelThreadedExecutor().asCoroutineDispatcher()withContextLuis Munoz
08/01/2019, 8:43 PMLuis Munoz
08/01/2019, 8:44 PMDominaezzz
08/01/2019, 8:45 PMDominaezzz
08/01/2019, 8:45 PMDominaezzz
08/01/2019, 8:45 PMLuis Munoz
08/01/2019, 8:49 PMgroostav
08/01/2019, 8:50 PMDominaezzz
08/01/2019, 8:51 PMLuis Munoz
08/01/2019, 8:57 PMDominaezzz
08/01/2019, 8:59 PMgroostav
08/01/2019, 11:32 PMExecutorsExecutors.newSingleThreadedExecutorExecutors.forkJoinPoolExecutors.make(context = SingleThreaded)val context = EmptyCoroutineContext + MySpecialContext
GlobalScope.launch(context) { /* job1 */ }
GlobalScope.launch(context) { /* job2 */ }Luis Munoz
08/07/2019, 7:52 PMLuis Munoz
08/07/2019, 7:52 PMLuis Munoz
08/07/2019, 7:52 PMDominaezzz
08/07/2019, 8:27 PMDominaezzz
08/07/2019, 8:29 PMgroostav
08/07/2019, 11:58 PMlaunchContextJobgroostav
08/08/2019, 12:04 AMsuspend funDispatchersmutex