Update vm.h

This commit is contained in:
blueloveTH 2022-12-04 21:15:18 +08:00
parent ffd6915de7
commit 9909e16649

View File

@ -1117,11 +1117,7 @@ public:
void suspend(){
if(_state != THREAD_RUNNING) UNREACHABLE();
_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(){
@ -1138,8 +1134,8 @@ public:
void writeJsonrpcResponse(const char* value){
if(_state != THREAD_SUSPENDED) UNREACHABLE();
_state = THREAD_RUNNING;
_sharedStr = _Str(value);
_state = THREAD_RUNNING;
}
void execAsync(const _Code& code) override {