|
|
@@ -1088,9 +1088,7 @@ class ThreadedVM : public VM {
|
|
|
|
|
|
void __deleteThread(){
|
|
|
if(_thread != nullptr){
|
|
|
- if(_state == THREAD_RUNNING || _state == THREAD_SUSPENDED){
|
|
|
- keyboardInterrupt();
|
|
|
- }
|
|
|
+ terminate();
|
|
|
_thread->join();
|
|
|
delete _thread;
|
|
|
_thread = nullptr;
|
|
|
@@ -1109,6 +1107,13 @@ public:
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ void terminate(){
|
|
|
+ if(_state == THREAD_RUNNING || _state == THREAD_SUSPENDED){
|
|
|
+ keyboardInterrupt();
|
|
|
+ while(_state != THREAD_FINISHED);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
void suspend(){
|
|
|
if(_state != THREAD_RUNNING) UNREACHABLE();
|
|
|
_state = THREAD_SUSPENDED;
|