diff options
Diffstat (limited to 'src/zenutil/workerpools.cpp')
| -rw-r--r-- | src/zenutil/workerpools.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/zenutil/workerpools.cpp b/src/zenutil/workerpools.cpp index b511b0c5c..3ae302064 100644 --- a/src/zenutil/workerpools.cpp +++ b/src/zenutil/workerpools.cpp @@ -14,6 +14,8 @@ namespace { const int LargeWorkerThreadPoolTreadCount = gsl::narrow<int>(std::thread::hardware_concurrency()); const int SmallWorkerThreadPoolTreadCount = gsl::narrow<int>(Max((std::thread::hardware_concurrency() / 4u), 1u)); + static bool IsShutDown = false; + RwLock PoolLock; std::unique_ptr<WorkerThreadPool> LargeWorkerPool; @@ -32,6 +34,7 @@ GetLargeWorkerPool() } } RwLock::ExclusiveLockScope _(PoolLock); + ZEN_ASSERT(!IsShutDown); if (LargeWorkerPool) { return *LargeWorkerPool; @@ -51,6 +54,7 @@ GetSmallWorkerPool() } } RwLock::ExclusiveLockScope _(PoolLock); + ZEN_ASSERT(!IsShutDown); if (SmallWorkerPool) { return *SmallWorkerPool; @@ -70,6 +74,7 @@ GetSyncWorkerPool() } } RwLock::ExclusiveLockScope _(PoolLock); + ZEN_ASSERT(!IsShutDown); if (SyncWorkerPool) { return *SyncWorkerPool; @@ -82,6 +87,7 @@ void ShutdownWorkerPools() { RwLock::ExclusiveLockScope _(PoolLock); + IsShutDown = true; LargeWorkerPool.reset(); SmallWorkerPool.reset(); SyncWorkerPool.reset(); |