Join Slack
Powered by
what is the use case/purpose of this?
# coroutines
r
Riku
12/29/2019, 8:19 AM
what is the use case/purpose of this?
t
tseisel
12/29/2019, 10:47 AM
The idea is to introduce a
ThreadLocal
variable to be shared between coroutines. This variable can be read from a running coroutine with
coroutineContext
.
r
Riku
12/29/2019, 12:37 PM
ok so do I understand correctly it is a way to share data between threads when using coroutines?
t
tseisel
12/29/2019, 3:07 PM
Coroutines offer an abstraction over using threads. They focus more on communicating between coroutines than sharing state between them. The main primitive to communicate between coroutines are `Channel`s :
https://kotlinlang.org/docs/reference/coroutines/shared-mutable-state-and-concurrency.html
2
Views
Open in Slack
Previous
Next