diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2022-11-10 10:54:09 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2022-11-10 13:20:27 +0100 |
commit | a33936b5e0bb61dedf9244056be167eb90678dd9 (patch) | |
tree | 6387dd2e9e9451a8e22fe7a86df810357ef0e1ab | |
parent | c4596d549d579c6ebc791b778bb5aceee659e365 (diff) | |
download | ccache-a33936b5e0bb61dedf9244056be167eb90678dd9.tar.gz |
enhance: Make subsequent calls to ThreadPool::shut_down NOPs
-rw-r--r-- | src/ThreadPool.cpp | 4 |
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(); |