Hi guys, is this statement true, specifically regr...
# coroutines
h
Hi guys, is this statement true, specifically regrading the part where they say: "The suspend functions that directly suspend a coroutine are in the standard library"?
Marking a function
suspend
gives it the capability to suspend the coroutine, but it will only actually suspend the coroutine if it internally calls another suspend function that suspends the coroutine. The suspend functions that directly suspend a coroutine are in the standard library. Among these are
suspendCoroutine()
and
suspendCancellableCoroutine()
. You will not often use these. They are most commonly used to convert non-coroutine APIs into suspend functions.
Some of the commonly used functions that indirectly suspend a coroutine are
withContext()
,
delay()
,
Job.join()
and
Deferred.await()
.
I found it in this Stackoverflow post.
j
Yes this is correct
👍 1
👍🏾 1