carbaj0
08/19/2019, 8:49 AMtailrec suspend fun call() : SomeObject =
if (!isAttempting)
startRetrievingCall()
else
call()octylFractal
08/19/2019, 9:08 AMMutex maybe? lock the mutex before startRetrievingCall, then lock it again after the call. This will suspend.
In startRetrievingCall, at some point unlock the mutex, which will resume the original call point.
Though to be honest, this looks like an XY situation, and you might be better served by async + Deferred, or a Channelcarbaj0
08/19/2019, 12:13 PMcarbaj0
08/19/2019, 12:13 PM