Skip to content

Commit

Permalink
Fix SimpleIdentity::isEmpty, increment runningCount early
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilsnd committed Jun 26, 2024
1 parent 3202788 commit e51d9e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/mbgl/util/identity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SimpleIdentity final {
bool operator!=(const SimpleIdentity& other) const noexcept { return uniqueID != other.uniqueID; }

std::int64_t id() const noexcept { return uniqueID; }
bool isEmpty() const noexcept { return uniqueID != emptyID; }
bool isEmpty() const noexcept { return uniqueID == emptyID; }

operator bool() const noexcept { return isEmpty(); }
bool operator!() const noexcept { return !isEmpty(); }
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/util/thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ std::thread ThreadedSchedulerBase::makeSchedulerThread(size_t index) {
{
std::lock_guard<std::mutex> lock(q->lock);
if (q->queue.size()) {
q->runningCount++;
tasklet = std::move(q->queue.front());
q->queue.pop();
}
if (!tasklet) continue;
}

assert(taskCount > 0);
q->runningCount++;
taskCount--;

try {
Expand Down

0 comments on commit e51d9e1

Please sign in to comment.