diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/thread_pool.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index 41aaf7d..050db20 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -29,9 +29,13 @@ void ThreadRun(ThreadPool *tp) { { std::unique_lock<std::mutex> lck(tp->mutex); tp->condition.wait(lck, [tp] { - return tp->jobQueue->Count() != 0 || !tp->isRunning || tp->isPaused; + if (!tp->isRunning) return true; + if (tp->isPaused) return true; + if (tp->jobQueue == nullptr) return true; + if (tp->jobQueue == CAFE_BABE(DynArray<std::packaged_task<void()> *>)) return true; + return tp->jobQueue->Count() != 0; }); - if (!tp->isRunning || tp->isPaused) { + if (!tp->isRunning || tp->isPaused || tp->jobQueue == nullptr || tp->jobQueue == CAFE_BABE(DynArray<std::packaged_task<void()> *>)) { return; } if (tp->jobQueue->Count() == 0) { |
