Update vm.h

This commit is contained in:
blueloveTH 2022-12-31 05:09:15 +08:00
parent f210de9675
commit 9c5284a381

View File

@ -1120,13 +1120,11 @@ public:
void terminate(){ void terminate(){
if(_state == THREAD_RUNNING || _state == THREAD_SUSPENDED){ if(_state == THREAD_RUNNING || _state == THREAD_SUSPENDED){
keyboardInterrupt(); keyboardInterrupt();
while(_state != THREAD_FINISHED) {
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
emscripten_sleep(20); // no way to terminate safely
#else #else
std::this_thread::sleep_for(std::chrono::milliseconds(20)); while(_state != THREAD_FINISHED);
#endif #endif
}
} }
} }