mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 21:18:35 +00:00
Bug 1239288 - Fix a race in the win32 job scheduler's shutdown. r=jrmuizel
This commit is contained in:
parent
42b3ccc897
commit
59f28c22d9
@ -132,9 +132,14 @@ MultiThreadedJobQueue::RegisterThread()
|
|||||||
void
|
void
|
||||||
MultiThreadedJobQueue::UnregisterThread()
|
MultiThreadedJobQueue::UnregisterThread()
|
||||||
{
|
{
|
||||||
CriticalSectionAutoEnter lock(&mSection);
|
mSection.Enter();
|
||||||
mThreadsCount -= 1;
|
mThreadsCount -= 1;
|
||||||
if (mThreadsCount == 0) {
|
bool finishShutdown = mThreadsCount == 0;
|
||||||
|
mSection.Leave();
|
||||||
|
|
||||||
|
if (finishShutdown) {
|
||||||
|
// Can't touch mSection or any other member from now on because this object
|
||||||
|
// may get deleted on the main thread after mShutdownEvent is set.
|
||||||
::SetEvent(mShutdownEvent);
|
::SetEvent(mShutdownEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user