Few clarification points: - By heavy I mean it can...
# coroutines
Few clarification points: - By heavy I mean it can block thread, e.g. long running operation - Yes, of course main point of
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 thread
is not a "marker" for things that block threads.
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
, as suggested in official coroutines guide
👍 1