Starting `freeze()` issue thread. Continued from h...
# multiplatform
k
Starting
freeze()
issue thread. Continued from here: https://kotlinlang.slack.com/archives/C3PQML5NU/p1567102026052800 cc @Kris Wong @basher
k
thanks
k
Thread is so we don’t sort out something interesting in private.
k
man, app code gets real confused when I right click in the editor
er, i don't even see how to run in tests in this thing
k
In app code?
k
yeah
k
I don’t know. I would just log before/after freeze and first confirm it is stopping there. The debugger may be tricky to set up for app code tests
k
that's definitely were it stopped when running in Xcode
let me try just running the app
k
How do you know if the debugger isn’t working?
k
i know it stopped there, I just can't step into the call to see where it stopped underneath that call
k
This is just freeze or it’s doing a bunch of threading stuff?
k
just freeze
k
You’re saying if I create an Xcode project and just call freeze on a kotlin object you’d expect it to deadlock?
In a test
k
well, the project is much complex than that, but that's essentially what happening
k
I guess I need to see that or I would assume something else is happening.
k
yeah I am trying to investigate but things are moving very slowly
k
I mean, I’ve had some strange issues with KN, but freeze deadlocking would indeed be a surprise
Freeze itself happens before you’ve shared code with other threads, so in theory it’s not locking on anything. If execution simply stops there, and you’re 100% sure it isn’t a crash or involved in some other form of infinite loop, it would be very interesting to see that in action.
k
wow, this is pretty spectacular
if you have this
actual fun <T> T.freeze(): T = this.freeze()
...
it's very important you also have this
import kotlin.native.concurrent.freeze
😂 2
b
ah nice
problem solved haha
k
because it builds w/o that, and then it's just an infinite loop
that was a fun exercise. thanks fellas.
k
I have done this
k
it's pretty easy to figure out when you can actually see the stack trace
a
You can use 'by' to import KN's freeze as e.g. 'freezeNative', then call it. It will be much less error prone.
🍻 1