Augusto
11/05/2022, 11:02 AMdelay()
public suspend fun delay(timeMillis: Long) {
if (timeMillis <= 0) return // don't delay
return suspendCancellableCoroutine sc@ { cont: CancellableContinuation<Unit> ->
//some extra code
}
}
I wonder if there's a reason to do return suspendCancellableCoroutine[...]
rather than just calling suspendCancellableCoroutine()
, as delay()
returns Unit
.Zach Klippenstein (he/him) [MOD]
11/05/2022, 4:44 PMAugusto
11/05/2022, 6:46 PMsuspendCancellableCoroutine()
), but I'm not sure if there's some extra magic 🙂ephemient
11/05/2022, 7:07 PMAugusto
11/05/2022, 8:02 PMephemient
11/05/2022, 10:24 PMdelay
probably pre-dates that.