OPTIMIZATION: Only notify the condition variable when needed

Former-commit-id: 11f07b49c613f54cef682da1e3c8fc54918809b0
This commit is contained in:
John Sully 2021-06-25 06:11:01 +00:00
parent f477186faa
commit d5246a79aa

View File

@ -6996,9 +6996,10 @@ void OnTerminate()
void wakeTimeThread() {
updateCachedTime();
std::lock_guard<std::mutex> lock(time_thread_mutex);
if (sleeping_threads >= cserver.cthreads)
time_thread_cv.notify_one();
sleeping_threads--;
serverAssert(sleeping_threads >= 0);
time_thread_cv.notify_one();
}
void *timeThreadMain(void*) {