https://kotlinlang.org logo
#coroutines
Title
# coroutines
c

coder82

07/01/2018, 8:30 AM
I am a huge fun of suspendCoroutine but sometimes I just to have a callback which signals me a value changed, I guess I need to provide it myself
g

gildor

07/01/2018, 9:06 AM
Right, you need some class that encapsulate state (value) and notifies on value set and if get value is suspendable function, you can just suspend until value is available. It's actually description of channels, but channel also support multi-thread usage and stream of events, not only single one.
3 Views