https://kotlinlang.org logo
#coroutines
Title
# coroutines
u

ursus

11/25/2020, 11:35 PM
I have a hard time deciding what methods should be blocking and what should be suspending. Is cancel-ability the rule of the thumb as to make it suspending?
j

Jon Michael Aanes

11/26/2020, 8:29 AM
Nah, not worth suspending that sort of functions. Actually, the fewer suspend functions the better, as non-suspend is more flexible. You only really need suspendables in the critical path between performing the underlying async task (IO, handle webrequests, whatever) and launching the coroutines.
u

uli

11/26/2020, 8:40 AM
@ursus can you give an example of a fun where you have a choice between blocking and suspending and are unsure
ups, just saw you gave one in the next post …
3 Views