From: Joel Rosdahl Date: Thu, 10 Nov 2022 09:54:09 +0000 (+0100) Subject: enhance: Make subsequent calls to ThreadPool::shut_down NOPs X-Git-Tag: v4.7.4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33936b5e0bb61dedf9244056be167eb90678dd9;p=thirdparty%2Fccache.git enhance: Make subsequent calls to ThreadPool::shut_down NOPs --- diff --git a/src/ThreadPool.cpp b/src/ThreadPool.cpp index a1d931a33..d5da4d507 100644 --- a/src/ThreadPool.cpp +++ b/src/ThreadPool.cpp @@ -51,6 +51,10 @@ ThreadPool::shut_down() { { std::unique_lock 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();