blueloveTH před 3 roky
rodič
revize
9909e16649
1 změnil soubory, kde provedl 2 přidání a 6 odebrání
  1. 2 6
      src/vm.h

+ 2 - 6
src/vm.h

@@ -1117,11 +1117,7 @@ public:
     void suspend(){
     void suspend(){
         if(_state != THREAD_RUNNING) UNREACHABLE();
         if(_state != THREAD_RUNNING) UNREACHABLE();
         _state = THREAD_SUSPENDED;
         _state = THREAD_SUSPENDED;
-        // 50 fps is enough
-        while(_state == THREAD_SUSPENDED){
-            _checkStopFlag();
-            std::this_thread::sleep_for(std::chrono::milliseconds(20));
-        }
+        while(_state == THREAD_SUSPENDED) _checkStopFlag();
     }
     }
 
 
     _Str readJsonRpcRequest(){
     _Str readJsonRpcRequest(){
@@ -1138,8 +1134,8 @@ public:
 
 
     void writeJsonrpcResponse(const char* value){
     void writeJsonrpcResponse(const char* value){
         if(_state != THREAD_SUSPENDED) UNREACHABLE();
         if(_state != THREAD_SUSPENDED) UNREACHABLE();
-        _state = THREAD_RUNNING;
         _sharedStr = _Str(value);
         _sharedStr = _Str(value);
+        _state = THREAD_RUNNING;
     }
     }
 
 
     void execAsync(const _Code& code) override {
     void execAsync(const _Code& code) override {