OPTIMIZATION: Only notify the condition variable when needed
Former-commit-id: 11f07b49c613f54cef682da1e3c8fc54918809b0
This commit is contained in:
parent
f477186faa
commit
d5246a79aa
@ -6996,9 +6996,10 @@ void OnTerminate()
|
|||||||
void wakeTimeThread() {
|
void wakeTimeThread() {
|
||||||
updateCachedTime();
|
updateCachedTime();
|
||||||
std::lock_guard<std::mutex> lock(time_thread_mutex);
|
std::lock_guard<std::mutex> lock(time_thread_mutex);
|
||||||
|
if (sleeping_threads >= cserver.cthreads)
|
||||||
|
time_thread_cv.notify_one();
|
||||||
sleeping_threads--;
|
sleeping_threads--;
|
||||||
serverAssert(sleeping_threads >= 0);
|
serverAssert(sleeping_threads >= 0);
|
||||||
time_thread_cv.notify_one();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *timeThreadMain(void*) {
|
void *timeThreadMain(void*) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user