groostav
03/03/2019, 7:39 PMUnconfined
to try and keep stacks neat. Namely I'd like to use an unconfined consumer to keep the producer on the stack trace, But I think there's a races making my life hard. AFAIK the contract with unconfined is so weak (and is aimed at performance, not debugability) that perhaps this isn't a bug per se, but Id still like to see it.
Proof-of-concept:
https://gist.github.com/Groostav/f8ef01ed830c14c394ac5b992d981aa1
if you put a breakpoint on send
and walk-through the the downstack implementation it will eventually invoke the receiver, If you just run the test, on my machine, the runBlocking
event loop will invoke the receiver.Vsevolod Tolstopyatov [JB]
03/04/2019, 10:01 AMsend
completes before line with GlobalScope.launch(Dispatchers.Unconfined)
is executed or after.
Moreover, during nested unconfined calls, kx.coroutines
does some magic and unrolls the stack in order to avoid possible stack overflowsgroostav
03/04/2019, 7:14 PMCoroutineContext
element, such that I could specify some tree of coroutines has this enabled in production? I want this because the majority of my coroutines, including javafx click handlers and this library I'm working on simply aren't performance sensitive, and would stand to gain a lot if the stack trace included the bubbling click event
as the ultimate "caused by" rather than an opaque Platform.runLater
kicked off by some resume method