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:
James Chen 2014-03-25 16:28:18 +08:00
commit 8f95e27dc7
1 changed files with 4 additions and 1 deletions

View File

@ -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)
{