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

Maciek

07/24/2020, 8:07 AM
can deferred value be shared between different scopes? Create builder in one, then start and await in another.
o

octylFractal

07/24/2020, 8:07 AM
I don't see why not
👍 2
as stated:
All functions on this interface and on all interfaces derived from it are thread-safe and can be safely invoked from concurrent coroutines without external synchronization.
m

Maciek

07/24/2020, 8:11 AM
thanks for clarification, that's what I was thinking but I wasn't sure because it doesn't say scope per se
z

Zach Klippenstein (he/him) [MOD]

07/24/2020, 12:41 PM
The concept of "coroutine scope" is just a convention for job hierarchies, along with some types and syntax to make it easy. In general, a suspend function (such as Deferred.await) can be called by any coroutine, regardless of Job, and any limitations on this should be very clearly documented. No such limitations exist on Deferred.
👍 1