summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2022-11-10 10:54:09 +0100
committerJoel Rosdahl <joel@rosdahl.net>2022-11-10 13:20:27 +0100
commita33936b5e0bb61dedf9244056be167eb90678dd9 (patch)
tree6387dd2e9e9451a8e22fe7a86df810357ef0e1ab
parentc4596d549d579c6ebc791b778bb5aceee659e365 (diff)
downloadccache-a33936b5e0bb61dedf9244056be167eb90678dd9.tar.gz
enhance: Make subsequent calls to ThreadPool::shut_down NOPs
-rw-r--r--src/ThreadPool.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ThreadPool.cpp b/src/ThreadPool.cpp
index a1d931a3..d5da4d50 100644
--- a/src/ThreadPool.cpp
+++ b/src/ThreadPool.cpp
@@ -51,6 +51,10 @@ ThreadPool::shut_down()
{
{
std::unique_lock<std::mutex> lock(m_mutex);
+ if (m_shutting_down) {
+ // Already called shut_down.
+ return;
+ }
m_shutting_down = true;
}
m_task_enqueued_or_shutting_down_condition.notify_all();