Multithreaded coroutines doesn’t always play nice ...
# touchlab-tools
k
Multithreaded coroutines doesn’t always play nice with the freezing stuff. The second block…
Copy code
withContext(Dispatchers.Default) {
            log.e { "Never get's executed" }
            log.e { "Never called" }
        }
references
log
, which is a field of
BreedModel
. That will cause
BreedModel
to freeze when coroutines tries to run that block on a different thread. That happens inside of coroutines “machinery”, which prior to native, didn’t really expect passing state between threads to throw exceptions.
ensureNeverFrozen()
is new and coroutines hasn’t always dealt with it properly. I’ve seen some bugs submitted about it. Also, look at other output and see if you see anything about coroutines and “machinery”. Sometimes you will see that.
k
I see, thank you for the detailed explanation