If I have something like ``` CoroutineScope(<h...
# coroutines
v
If I have something like
Copy code
CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>).async {
        // Do some work
    }
Would this link the scope that I just created to parent scope (i.e. would parent wait)
a
what do you mean?
Copy code
launch {
                val data = async(IO) {
                    dataRepository.getData()
                }
                data.await()
}
s
I don’t think it does. Do this instead to be sure the parent scope’s context is inherited
Copy code
async(context = <http://Dispatchers.IO|Dispatchers.IO>) {
        // Do some work
    }
v
Actually no, if I don't do await on the Deferred coming back. Would my caller scope wait for child scope to terminate? i.e. Does the async body acts like if I were to launch it in
GlobalScope.async
. I am trying to make it behave like
GlobalScope
g
No, it will not, there is no Parent/Child relationships, new Job will be implicitly created
You can pass job (or context) from parent scope, but this style is not recommended
v
👍