mirror of https://github.com/axmolengine/axmol.git
issue #2305: Fixing a bug that passing wrong mutex parameter to "wait".
This commit is contained in:
parent
f2ab73c533
commit
3ad11cc63a
|
@ -104,13 +104,14 @@ static void networkThread(void)
|
||||||
// step 1: send http request if the requestQueue isn't empty
|
// step 1: send http request if the requestQueue isn't empty
|
||||||
request = NULL;
|
request = NULL;
|
||||||
|
|
||||||
{
|
s_requestQueueMutex.lock();
|
||||||
std::unique_lock<std::mutex> lk(s_requestQueueMutex); //Get request task from queue
|
request = dynamic_cast<HttpRequest*>(s_requestQueue->objectAtIndex(0));
|
||||||
s_SleepCondition.wait(lk, []{ return 0 != s_requestQueue->count(); });
|
s_requestQueue->removeObjectAtIndex(0);
|
||||||
|
s_requestQueueMutex.unlock();
|
||||||
request = dynamic_cast<HttpRequest*>(s_requestQueue->objectAtIndex(0));
|
|
||||||
s_requestQueue->removeObjectAtIndex(0);
|
std::unique_lock<std::mutex> lk(s_SleepMutex); //Get request task from queue
|
||||||
}
|
s_SleepCondition.wait(lk, []{ return 0 != s_requestQueue->count(); });
|
||||||
|
|
||||||
|
|
||||||
// step 2: libcurl sync access
|
// step 2: libcurl sync access
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue