https://kotlinlang.org logo
#coroutines
Title
# coroutines
n

Nick

04/19/2020, 10:32 PM
Is it possible to do cooperative cancellation with just the standard lib? I know kotlinx.coroutines offers APIs for this. But I’m wondering if there’s basic support in the standard lib directly. I haven’t seen anything so far. I’m trying to avoid using kotlinx if possible due to JS bundle size concerns.
o

octylFractal

04/19/2020, 10:47 PM
no, the stdlib doesn't have any of the structured concurrency stuff, or any dispatchers, cancellation, etc. You can obviously rebuild it, but you're likely to make many more mistakes than using the kotlinx coroutines libs
all the stdlib provides is the
Continuation
,
CoroutineContext
, and the interceptor framework
2 Views