yuya_horita
11/14/2018, 9:14 AM<https://github.com/Kotlin/kotlinx.coroutines/issues/462>
, but I can’t get it in detail.
(Only single thread will be supported and improved ?)Tobi
11/14/2018, 9:32 AM<http://Dispatchers.IO|Dispatchers.IO>
and waiting for the result using async
is not possible?yuya_horita
11/14/2018, 9:38 AMyuya_horita
11/14/2018, 9:41 AMval
.yuya_horita
11/14/2018, 9:43 AMfinal class Default: Kotlinx_coroutines_core_nativeCoroutineDispatcher {
override func dispatch(context: KotlinCoroutineContext, block: Kotlinx_coroutines_core_nativeRunnable) {
DispatchQueue.global(qos: .default).async { block.run() }
}
}
I’m writing codes like this. It seems that when I access block
, this code crashes.yuya_horita
11/14/2018, 9:44 AMDispatchQueue.main
instead of global(qos: .default)
yuya_horita
11/14/2018, 9:46 AMKonstantin Petrukhnov
11/14/2018, 6:01 PMKonstantin Petrukhnov
11/14/2018, 6:02 PMyuya_horita
11/14/2018, 6:18 PMLanderl Young
11/16/2018, 10:41 AMTobi
11/16/2018, 11:11 AMelizarov
11/16/2018, 11:12 AMyuya_horita
11/21/2018, 2:23 AMyuya_horita
11/21/2018, 2:23 AMyuya_horita
11/21/2018, 2:24 AMDispatchQueue.main.async {
print("1")
sleep(10) // this is a heavy processing
print("2")
sleep(10)
}
httpCall() // This is a function showing `hello` after receiving response. Dispatched to main queue with coroutines
print("I'm here")
yuya_horita
11/21/2018, 2:27 AMI'm here
1
2
hello
yuya_horita
11/21/2018, 2:28 AMhello
will be printed after 20seconds later. This is a problem.yuya_horita
11/21/2018, 2:29 AMyuya_horita
11/21/2018, 2:32 AM