Created
December 8, 2018 08:36
-
-
Save mehdok/fe98a99f49501afb39e35773cc977219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.coroutines.* | |
import kotlinx.coroutines.* | |
import platform.darwin.* | |
internal actual val dispatcher: CoroutineDispatcher = NsQueueDispatcher(dispatch_get_main_queue()) | |
internal class NsQueueDispatcher(private val dispatchQueue: dispatch_queue_t) : CoroutineDispatcher() { | |
override fun dispatch(context: CoroutineContext, block: Runnable) { | |
dispatch_async(dispatchQueue) { | |
block.run() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment