fixed #3868. Add guard check to send method of HttpClient

This commit is contained in:
andyque 2014-03-04 10:07:49 +08:00
parent 0cfb5169a4
commit 629c6b9a89
1 changed files with 8 additions and 6 deletions

View File

@ -469,12 +469,14 @@ void HttpClient::send(HttpRequest* request)
request->retain();
s_requestQueueMutex.lock();
s_requestQueue->pushBack(request);
s_requestQueueMutex.unlock();
// Notify thread start to work
s_SleepCondition.notify_one();
if (nullptr != s_requestQueue) {
s_requestQueueMutex.lock();
s_requestQueue->pushBack(request);
s_requestQueueMutex.unlock();
// Notify thread start to work
s_SleepCondition.notify_one();
}
}
// Poll and notify main thread if responses exists in queue