mirror of https://github.com/axmolengine/axmol.git
Merge pull request #5943 from koowolf/websocket_fix
closed #4542: WebsocketTest crashes on win32, it may delete mutex which is still being locked
This commit is contained in:
commit
8f95e27dc7
|
@ -187,16 +187,19 @@ void WsThreadHelper::update(float dt)
|
|||
WsMessage *msg = nullptr;
|
||||
|
||||
// Returns quickly if no message
|
||||
std::lock_guard<std::mutex> lk(_UIWsMessageQueueMutex);
|
||||
_UIWsMessageQueueMutex.lock();
|
||||
|
||||
if (0 == _UIWsMessageQueue->size())
|
||||
{
|
||||
_UIWsMessageQueueMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
// Gets message
|
||||
msg = *(_UIWsMessageQueue->begin());
|
||||
_UIWsMessageQueue->pop_front();
|
||||
|
||||
_UIWsMessageQueueMutex.unlock();
|
||||
|
||||
if (_ws)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue