|
| 1 | +# Module kotlinx-coroutines-core |
| 2 | + |
| 3 | +Core primitives to work with coroutines. |
| 4 | + |
| 5 | +# Package kotlinx.coroutines.experimental |
| 6 | + |
| 7 | +General-purpose coroutine builders and contexts. |
| 8 | + |
| 9 | +* `launch(context) {...}` to start a coroutine in the given context and get reference to its `Job`. |
| 10 | +* `run(context) {...}` to switch to a different context inside a coroutine. |
| 11 | +* `runBlocking {...}` to use asynchronous Kotlin APIs from a thread-blocking code. |
| 12 | +* `defer(context) {...}` and `lazyDefer(context) {...}` to get a deferred result of coroutine execution in a |
| 13 | + non-blocking way via a light-weight future interface called `Deferred`. |
| 14 | +* `delay(...)` for a non-blocking sleep in coroutines and |
| 15 | + `yield()` to release a thread in single-threaded dispatchers. |
| 16 | +* `withTimeout(timeout) {...}` scope function to easily set coroutine time-limit (deadline), |
| 17 | + and `NonCancellable` context to avoid it when needed. |
| 18 | +* `CommonPool` and `Unconfined` contexts, access to `context` of a parent coroutine in its `CoroutineScope`. |
| 19 | +* `newSingleThreadContext(...)` and `newFixedThreadPoolContext(...)` functions, |
| 20 | + `Executor.toCoroutineDispatcher()` extension. |
| 21 | +* Cancellation support with `Job` interface and `suspendCancellableCoroutine` helper function. |
| 22 | +* Debugging facilities for coroutines (run JVM with `-ea` or `-Dkotlinx.coroutines.debug` options) and |
| 23 | + `newCoroutineContext(context)` function to write user-defined coroutine builders that work with these |
| 24 | + debugging facilities. |
| 25 | + |
| 26 | +# Package kotlinx.coroutines.experimental.channels |
| 27 | + |
| 28 | +Channels -- non-blocking primitives for communicating a stream of values between coroutines. |
| 29 | + |
| 30 | +* `Channel`, `SendChannel`, and `ReceiveChannel` interfaces, |
| 31 | +* `RendezvousChannel` (unbuffered) and `ArrayChannel` (buffered) implementations |
| 32 | +* `Channel()` factory function and `buildChannel{}` coroutines builder. |
0 commit comments