Fix runtime deinit sequence. (#3227)

This commit is contained in:
Nikolay Igotti
2019-07-29 17:27:46 +03:00
committed by GitHub
parent 9c5e2a44c7
commit 93662b8b18
2 changed files with 1 additions and 2 deletions
-2
View File
@@ -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);
} }
+1
View File
@@ -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)