Implement Set, Refactor Map into Tree

This commit is contained in:
Dynamitos
2023-12-22 19:46:07 +01:00
parent ac1d11402e
commit c8f99bb64d
20 changed files with 674 additions and 603 deletions
+6 -9
View File
@@ -25,16 +25,14 @@ ThreadPool::~ThreadPool()
void ThreadPool::runAndWait(List<std::function<void()>> functions)
{
{
std::unique_lock l(taskLock);
currentTask.numRemaining = functions.size();
currentTask.functions = std::move(functions);
taskCV.notify_all();
}
std::unique_lock l(taskLock);
currentTask.numRemaining = functions.size();
currentTask.functions = std::move(functions);
taskCV.notify_all();
while (currentTask.numRemaining > 0)
{
std::unique_lock l2(completedLock);
completedCV.wait(l2);
completedCV.wait(l);
}
}
@@ -59,7 +57,6 @@ void ThreadPool::work()
currentTask.numRemaining--;
if (currentTask.numRemaining == 0)
{
std::unique_lock l2(completedLock);
completedCV.notify_one();
}
}