Native: improve ObjCExport thread state switching

This commit is contained in:
Svyatoslav Scherbina
2021-05-25 14:16:08 +03:00
committed by Space
parent 388538be60
commit fa36ccedeb
14 changed files with 173 additions and 51 deletions
@@ -149,6 +149,7 @@ RuntimeState* initRuntime() {
}
void deinitRuntime(RuntimeState* state, bool destroyRuntime) {
AssertThreadState(state->memoryState, kotlin::ThreadState::kRunnable);
RuntimeAssert(state->status == RuntimeStatus::kRunning, "Runtime must be in the running state");
state->status = RuntimeStatus::kDestroying;
// This may be called after TLS is zeroed out, so ::runtimeState and ::memoryState in Memory cannot be trusted.