зеркало из https://github.com/mozilla/pjs.git
Bugzilla bug #32779: PR_Interrupt should increment the cv's
pending_notify count before broadcasting on the cv to prevent the interrupted thread from destroying the cv before pthread_cond_broadcast returns.
This commit is contained in:
Родитель
74ccfe056f
Коммит
20725ce270
|
@ -654,8 +654,12 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred)
|
||||||
cv = thred->waiting;
|
cv = thred->waiting;
|
||||||
if ((NULL != cv) && !thred->interrupt_blocked)
|
if ((NULL != cv) && !thred->interrupt_blocked)
|
||||||
{
|
{
|
||||||
PRIntn rv = pthread_cond_broadcast(&cv->cv);
|
PRIntn rv;
|
||||||
|
(void)PR_AtomicIncrement(&cv->notify_pending);
|
||||||
|
rv = pthread_cond_broadcast(&cv->cv);
|
||||||
PR_ASSERT(0 == rv);
|
PR_ASSERT(0 == rv);
|
||||||
|
if (0 > PR_AtomicDecrement(&cv->notify_pending))
|
||||||
|
PR_DestroyCondVar(cv);
|
||||||
}
|
}
|
||||||
return PR_SUCCESS;
|
return PR_SUCCESS;
|
||||||
} /* PR_Interrupt */
|
} /* PR_Interrupt */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче