Skip to content

Commit

Permalink
Check thread status before waiting, use const iterator on map
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsnd committed May 21, 2024
1 parent ce46972 commit 13d58b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mbgl/util/thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std::thread ThreadedSchedulerBase::makeSchedulerThread(size_t index) {
{
// 1. Gather buckets for us to visit this iteration
std::shared_lock<std::shared_mutex> lock(taggedQueueLock);
for (auto& [tag, q] : taggedQueue) {
for (const auto& [tag, q] : taggedQueue) {
pending.push_back(q);
}
}
Expand Down Expand Up @@ -95,7 +95,9 @@ std::thread ThreadedSchedulerBase::makeSchedulerThread(size_t index) {

if (!didWork) {
std::unique_lock<std::mutex> conditionLock(workerMutex);
cvAvailable.wait(conditionLock);
if (!terminated) {
cvAvailable.wait(conditionLock);
}
}
}

Expand Down

0 comments on commit 13d58b0

Please sign in to comment.