Package-level declarations
Types
CountDownLatch allows for awaiting a given number of countdown signals. Models the behavior of java.util.concurrent.CountDownLatch in Kotlin with suspend.
A CyclicBarrier is a synchronization mechanism that allows a set of coroutines to wait for each other to reach a certain point before continuing execution. It is called a "cyclic" barrier because it can be reused after all coroutines have reached the barrier and released.
A scope that allows racing multiple coroutine blocks against each other. The first block to complete successfully will provide the result, and all other blocks will be cancelled.
A scope that combines CoroutineScope and Raise capabilities, allowing for both coroutine operations and error handling within a single scope.
Resource models resource allocation and releasing. It is especially useful when multiple resources that depend on each other need to be acquired and later released in reverse order. The capability of installing resources is called ResourceScope, and Resource defines the value associating the acquisition step, and the finalizer. Resource allocates and releases resources in a safe way that co-operates with Structured Concurrency, and KotlinX Coroutines.
Temporary intersection type, until we have context receivers
Functions
Deconstruct Resource into an A and a release handler. The release action must always be called, if never called, then the resource A will leak. The release step is already made NonCancellable to guarantee correct invocation like Resource or bracketCase, and it will automatically rethrow, and compose, the exceptions as needed.
Creates a Resource from an AutoCloseable, which uses AutoCloseable.close for releasing.
Describes a task with safe resource acquisition and release in the face of errors and interruption. It would be the equivalent of an async capable try/catch/finally statements in mainstream imperative languages for resource acquisition and release.
A way to safely acquire a resource and release in the face of errors and cancellation. It uses ExitCase to distinguish between different exit cases when releasing the acquired resource.
Creates a Resource from an Closeable, which uses Closeable.close for releasing.
Creates a single threaded CoroutineContext as a Resource. Upon release an orderly shutdown of the ExecutorService takes place in which previously submitted tasks are executed, but no new tasks will be accepted.
Flow that emits Unit every period while taking into account how much time it takes downstream to consume the emission. If downstream takes longer to process than period than it immediately emits another Unit, if you set dampen to false it will send n = downstreamTime / period Unit elements immediately.
Creates a single threaded CoroutineContext as a Resource. Upon release an orderly shutdown of the ExecutorService takes place in which previously submitted tasks are executed, but no new tasks will be accepted.
Like map, but will evaluate transform in parallel, emitting the results downstream in the same order as the input stream. The number of concurrent effects is limited by concurrency.
Like mapNotNull, but will evaluate effects in parallel, emitting the results downstream. The number of concurrent effects is limited by concurrency.
Like map, but will evaluate effects in parallel, emitting the results downstream. The number of concurrent effects is limited by concurrency.
Runs fa, fb in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd, fe in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff in parallel on ctx and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff, fg in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff, fg in parallel on ctx and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff, fg, fh in parallel on Dispatchers.Default and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff, fg, fh in parallel on ctx and combines their results using the provided function.
Runs fa, fb, fc, fd, fe, ff, fg, fh, fi in parallel on Dispatchers.Default and combines their results using the provided function.
Races a coroutine block against other blocks in the racing scope. If the block raises an error, it will be handled by handleError. If the block throws an exception, it will be handled by kotlinx.coroutines.CoroutineExceptionHandler. The block will be cancelled if another block completes first.
Races a coroutine block against other blocks in the racing scope. If the block throws an exception, it will be handled by CoroutineExceptionHandler. The block will be cancelled if another block completes first.
Races the participants fa, fb in parallel on the Dispatchers.Default. The winner of the race cancels the other participants. Cancelling the operation cancels all participants. An uncancellable participant will back-pressure the result of raceN.
Races the participants fa, fb on the provided CoroutineContext. The winner of the race cancels the other participants. Cancelling the operation cancels all participants.
Races the participants fa, fb&fc in parallel on the Dispatchers.Default. The winner of the race cancels the other participants. Cancelling the operation cancels all participants.
Races the participants fa, fb&fc on the provided CoroutineContext. The winner of the race cancels the other participants. Cancelling the operation cancels all participants.
Races a coroutine block against other blocks in the racing scope. If the block raises an error, it will be handled by handleError. The block will be cancelled if another block completes first.
The resourceScope function creates the ResourceScope instances, runs the user action while allocating the installed resources. upon ExitCase.Completed, ExitCase.Cancelled or ExitCase.Failure runs all the release finalizers.
Creates a single threaded CoroutineContext as a Resource. Upon release an orderly shutdown of the ExecutorService takes place in which previously submitted tasks are executed, but no new tasks will be accepted.