Dmytro Danylyk
04/01/2018, 3:58 AMsuspend
keyword is to mark suspension points, but it also serve as “marker” for caller: this function is compiled to function with continuation (callback) = this function has suspension point = this function may block your threadlouiscad
04/01/2018, 5:52 AMsuspend
is not a "marker" for things that block threads. suspend
is solely for allowing suspension points. If you want to have blocking code that can run on arbitrary thread pool, then coroutines are not your solution. "Regular" blocking code is yours, and a custom documented annotation, plus maybe ruling out UI/event loop thread(s) are your best solutions. A good one also is to name your function getUserByIdBlocking(…)
, as suggested in official coroutines guide