mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
Bug 806822: avoid race condition in gathering stats r=ehugg
This commit is contained in:
parent
38c1bec0e2
commit
412ada1719
@ -597,17 +597,20 @@ cprSendMessage (cprMsgQueue_t msgQueue, void *msg, void **ppUserData)
|
||||
*/
|
||||
if (msgq->extendedQDepth < msgq->maxExtendedQDepth) {
|
||||
rc = cprPostExtendedQMsg(msgq, msg, ppUserData);
|
||||
|
||||
// do under lock to avoid races
|
||||
if (rc == CPR_MSGQ_POST_SUCCESS) {
|
||||
cprPegSendMessageStats(msgq, numAttempts);
|
||||
} else {
|
||||
msgq->sendErrors++;
|
||||
}
|
||||
(void) pthread_mutex_unlock(&msgq->mutex);
|
||||
|
||||
if (rc == CPR_MSGQ_POST_SUCCESS) {
|
||||
cprPegSendMessageStats(msgq, numAttempts);
|
||||
return CPR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
CPR_ERROR(error_str, fname, msgq->name, "no memory");
|
||||
msgq->sendErrors++;
|
||||
return CPR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user