This commit is contained in:
blueloveTH 2022-12-31 05:09:37 +08:00
parent 9c5284a381
commit 1044475f70
2 changed files with 3 additions and 5 deletions

View File

@ -5026,15 +5026,13 @@ 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
} }
} }
}
void suspend(){ void suspend(){
if(_state != THREAD_RUNNING) UNREACHABLE(); if(_state != THREAD_RUNNING) UNREACHABLE();

@ -1 +1 @@
Subproject commit 3b6f3c85037a67fe1f8817ffa40532b3c1ecc728 Subproject commit d3c5ec6fdf62217fb18c08c0e19ccea21d41ab18