Fix runtime deinit sequence. (#3227)
This commit is contained in:
@@ -1552,7 +1552,6 @@ MemoryState* suspendMemory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void resumeMemory(MemoryState* state) {
|
void resumeMemory(MemoryState* state) {
|
||||||
RuntimeAssert(::memoryState == nullptr, "Cannot schedule on existing state");
|
|
||||||
::memoryState = state;
|
::memoryState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2489,7 +2488,6 @@ MemoryState* InitMemory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeinitMemory(MemoryState* memoryState) {
|
void DeinitMemory(MemoryState* memoryState) {
|
||||||
::memoryState = memoryState;
|
|
||||||
deinitMemory(memoryState);
|
deinitMemory(memoryState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ RuntimeState* initRuntime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deinitRuntime(RuntimeState* state) {
|
void deinitRuntime(RuntimeState* state) {
|
||||||
|
ResumeMemory(state->memoryState);
|
||||||
bool lastRuntime = atomicAdd(&aliveRuntimesCount, -1) == 0;
|
bool lastRuntime = atomicAdd(&aliveRuntimesCount, -1) == 0;
|
||||||
InitOrDeinitGlobalVariables(DEINIT_THREAD_LOCAL_GLOBALS);
|
InitOrDeinitGlobalVariables(DEINIT_THREAD_LOCAL_GLOBALS);
|
||||||
if (lastRuntime)
|
if (lastRuntime)
|
||||||
|
|||||||
Reference in New Issue
Block a user