Viktor Vostrikov
05/05/2020, 5:57 AMoctylFractal
05/05/2020, 5:58 AMexecute(coroutineScope: CoroutineScope, bitmap: Bitmap)
is the same as CoroutineScope.execute(bitmap: Bitmap)
in terms of bytecodeoctylFractal
05/05/2020, 5:58 AMoctylFractal
05/05/2020, 6:00 AMoctylFractal
05/05/2020, 6:00 AMViktor Vostrikov
05/05/2020, 6:01 AMoctylFractal
05/05/2020, 6:01 AMViktor Vostrikov
05/05/2020, 6:02 AMViktor Vostrikov
05/05/2020, 6:06 AMViktor Vostrikov
05/05/2020, 6:07 AMoctylFractal
05/05/2020, 6:09 AMoctylFractal
05/05/2020, 6:17 AMViktor Vostrikov
05/05/2020, 6:46 AMoctylFractal
05/05/2020, 6:51 AMViktor Vostrikov
05/05/2020, 6:56 AMoctylFractal
05/05/2020, 7:11 AMViktor Vostrikov
05/05/2020, 7:16 AMViktor Vostrikov
05/05/2020, 7:17 AMViktor Vostrikov
05/05/2020, 7:19 AMViktor Vostrikov
05/05/2020, 7:21 AMoctylFractal
05/05/2020, 7:23 AMcoroutineScope {}
will wait until all things started inside are completedViktor Vostrikov
05/05/2020, 7:23 AMcoroutineScope{
}
If I call this suspend fun with viewModelScope.launch{
}
that means that coroutineScope inherits viewModelScope, yes? :)octylFractal
05/05/2020, 7:23 AMViktor Vostrikov
05/05/2020, 7:24 AMoctylFractal
05/05/2020, 7:24 AMcoroutineScope {}
really knows nothing about the viewModelScope
, it will just take the current coroutineContext
+ Job(coroutineContext[Job])
and create a new scope with those elementsoctylFractal
05/05/2020, 7:25 AMJob
, but it may not necessarily have anything else in common with it (such as dispatcher)Viktor Vostrikov
05/05/2020, 7:26 AMoctylFractal
05/05/2020, 7:27 AMawait
ingoctylFractal
05/05/2020, 7:28 AMviewModelScope
is appropriate here) and launch
it thereoctylFractal
05/05/2020, 7:29 AMcoroutineScope {}
-created scope will cause your function to suspend at the end of the block until every child Job is doneViktor Vostrikov
05/05/2020, 7:29 AMViktor Vostrikov
05/05/2020, 7:38 AMoctylFractal
05/05/2020, 7:39 AMViktor Vostrikov
05/05/2020, 8:16 AM