Rohan Maity
12/02/2023, 4:36 AMscheduleResumeAfterDelay
works, upon looking into the code, this method is implemented by several CoroutineContexts like HandlerContext
, DarwinContext
But I cannot find these files in kotlin coroutines github repo
Can someone help me here, what I am doing wrong here?Sam
12/02/2023, 9:19 AMSam
12/02/2023, 9:19 AMHandlerContext
mentions the word "context" in its name is slightly misleading. That class is actually part of the implementation of the HanderDispatcher
, which you can find here. Meanwhile the Darwin dispatcher you mentioned is probably this one, although it doesn't include a class named DarwinContext
.Sam
12/02/2023, 9:22 AMRohan Maity
12/02/2023, 9:37 AMSam
12/02/2023, 9:45 AMJob
, which tracks whether the coroutine is started, completed, cancelled, etc. The context can also contain a handler for uncaught exceptions; a coroutine name for use when debugging; and some "thread local" elements for integrating with thread-based Java code.
The thing that can make it confusing is that each individual context element can be used as a singleton context in its own right.
val context2 = Dispatchers.Default + Job() // context containing two elements
val context1 = Dispatchers.Default // context containing only one element
Rohan Maity
12/09/2023, 2:50 AM