https://github.com/domnikl/kotlin-coroutine-examples
Examples using Kotlin coroutines
https://github.com/domnikl/kotlin-coroutine-examples
asynchronous-programming concurrent-programming coroutines kotlin
Last synced: about 1 year ago
JSON representation
Examples using Kotlin coroutines
- Host: GitHub
- URL: https://github.com/domnikl/kotlin-coroutine-examples
- Owner: domnikl
- License: mit
- Created: 2019-08-29T06:30:25.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2023-08-23T11:41:29.000Z (almost 3 years ago)
- Last Synced: 2025-06-08T08:04:15.352Z (about 1 year ago)
- Topics: asynchronous-programming, concurrent-programming, coroutines, kotlin
- Language: Kotlin
- Size: 222 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Kotlin coroutine examples
It attempts to explain various use-cases around coroutines in simple terms to explain them.
1. [concurrency](src/main/kotlin/concurrency.kt): run multiple coroutines concurrently
1. [yield](src/main/kotlin/yield.kt): using `yield()` to yield dispatcher to other coroutines
1. [default dispatcher](src/main/kotlin/default_dispatcher.kt): using `Dispatchers.Default` to run coroutines in parallel
1. [Thread pool](src/main/kotlin/thread_pool.kt): using a fixed Thread pool for coroutines
1. [async](src/main/kotlin/async.kt): `async()` and `await()`
1. [launch and exceptions](src/main/kotlin/launch_and_exceptions.kt): how to handle exceptions in coroutines
1. [async and exceptions](src/main/kotlin/async_and_exceptions.kt): exceptions in `async()` coroutines
1. [produce](src/main/kotlin/produce.kt): how to produce values and use `ReceiveChannel`
1. [actors](src/main/kotlin/actors.kt): how to use actors in Kotlin
1. [flow](src/main/kotlin/flow.kt): uing `Flow` to build sequential streams of events