Bug 969709 - Fix race in ThreadPool::abortJob; fixes intermittent oranges on a CLOSED TREE. (r=nmatsakis)

This commit is contained in:
Shu-yu Guo 2014-02-07 17:39:00 -08:00
Родитель 209b2e8849
Коммит 8ab0b01fd6
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -589,4 +589,14 @@ ThreadPool::abortJob()
mainWorker_->abort();
for (uint32_t workerId = 0; workerId < numWorkers(); workerId++)
workers_[workerId]->abort();
// Spin until pendingSlices_ reaches 0.
//
// The reason for this is that while calling abort() clears all workers'
// bounds, the pendingSlices_ cache might still be > 0 due to
// still-executing calls to popSliceBack or popSliceFront in other
// threads. When those finish, we will be sure that !hasWork(), which is
// important to ensure that an aborted worker does not start again due to
// the thread pool having more work.
while (hasWork());
}