Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Fixed: missing functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vovahost authored and johsoe committed Feb 5, 2019
1 parent 89d1800 commit 5363e11
Showing 1 changed file with 14 additions and 2 deletions.
@@ -1,7 +1,11 @@
package dk.nodes.arch.domain.executor

import dk.nodes.arch.extensions.launch
import dk.nodes.arch.extensions.launchOnUI
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext

class KoroutineExecutor : Executor {

Expand All @@ -20,4 +24,12 @@ class KoroutineExecutor : Executor {
override fun signal(condId: String) {
SignalDispatcher.signal(condId)
}

private fun launch(
context: CoroutineContext = EmptyCoroutineContext,
block: suspend CoroutineScope.() -> Unit
) = GlobalScope.launch(context = context, block = block)

private fun launchOnUI(block: suspend CoroutineScope.() -> Unit) =
launch(context = Dispatchers.Main, block = block)
}

0 comments on commit 5363e11

Please sign in to comment.