зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1239288 - Fix a race in the win32 job scheduler's shutdown. r=jrmuizel
This commit is contained in:
Родитель
42b3ccc897
Коммит
59f28c22d9
|
@ -132,9 +132,14 @@ MultiThreadedJobQueue::RegisterThread()
|
|||
void
|
||||
MultiThreadedJobQueue::UnregisterThread()
|
||||
{
|
||||
CriticalSectionAutoEnter lock(&mSection);
|
||||
mSection.Enter();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче