Merge
This commit is contained in:
commit
5f49f406c7
@ -625,17 +625,27 @@ void CompileQueue::add(CompileTask* task) {
|
|||||||
lock()->notify_all();
|
lock()->notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empties compilation queue by putting all compilation tasks onto
|
||||||
|
* a freelist. Furthermore, the method wakes up all threads that are
|
||||||
|
* waiting on a compilation task to finish. This can happen if background
|
||||||
|
* compilation is disabled.
|
||||||
|
*/
|
||||||
void CompileQueue::free_all() {
|
void CompileQueue::free_all() {
|
||||||
MutexLocker mu(lock());
|
MutexLocker mu(lock());
|
||||||
if (_first != NULL) {
|
CompileTask* next = _first;
|
||||||
for (CompileTask* task = _first; task != NULL; task = task->next()) {
|
|
||||||
// Wake up thread that blocks on the compile task.
|
// Iterate over all tasks in the compile queue
|
||||||
task->lock()->notify();
|
while (next != NULL) {
|
||||||
// Puts task back on the freelist.
|
CompileTask* current = next;
|
||||||
CompileTask::free(task);
|
next = current->next();
|
||||||
}
|
// Wake up thread that blocks on the compile task.
|
||||||
_first = NULL;
|
current->lock()->notify();
|
||||||
|
// Put the task back on the freelist.
|
||||||
|
CompileTask::free(current);
|
||||||
}
|
}
|
||||||
|
_first = NULL;
|
||||||
|
|
||||||
// Wake up all threads that block on the queue.
|
// Wake up all threads that block on the queue.
|
||||||
lock()->notify_all();
|
lock()->notify_all();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user