talira

Kotlin Coroutines

Library support for Kotlin coroutines

open sourceApache-2.0self-hostablefree

kotlinx.coroutines is JetBrains official library for asynchronous and concurrent programming in Kotlin, built on suspending functions. It provides the launch and async coroutine builders with structured concurrency and cancellation, dispatchers for background work, blocking I/O and UI main threads, Flow for cold asynchronous streams, channels, mutexes and semaphores, and select expressions. It works across Kotlin Multiplatform targets (JVM, Android, JavaScript, Wasm and native), with modules for testing (runTest), debugging live coroutines, integrating with Reactive Streams, RxJava and Project Reactor, and Main dispatchers for Android, JavaFX and Swing.

Problems it solves

  • write asynchronous Kotlin code without callbacks or blocking threads
  • run many concurrent network calls in my Android app and cancel them when the screen closes
  • stream values asynchronously in Kotlin and transform them with operators
  • test suspending functions without real delays

Features

  • launch and async coroutine builders
  • structured concurrency and cancellation
  • dispatchers for Default, IO and Main threads
  • Flow cold asynchronous streams
  • channels, Mutex and Semaphore
  • select expressions
  • Kotlin Multiplatform: JVM, Android, JS, Wasm, native
  • test utilities with runTest and TestScope
  • debug probes for live coroutines
  • Reactive Streams, RxJava and Reactor integration

Alternatives

The same job

These do what Kotlin Coroutines does.

  1. RxJava Reactive Extensions for the JVM

Compare Kotlin Coroutines with the top 3