Update vm.h

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

View File

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