set thread as offline when waiting for time thread lock
This commit is contained in:
parent
395eb1fd3a
commit
b1f0d8ddf5
@ -2956,6 +2956,7 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
|
||||
if (!fSentReplies)
|
||||
handleClientsWithPendingWrites(iel, aof_state);
|
||||
|
||||
aeThreadOffline();
|
||||
// Scope lock_guard
|
||||
{
|
||||
std::unique_lock<fastlock> lock(time_thread_lock);
|
||||
@ -2972,7 +2973,7 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
|
||||
g_pserver->garbageCollector.endEpoch(epoch);
|
||||
}, true /*fHiPri*/);
|
||||
}
|
||||
aeThreadOffline();
|
||||
|
||||
/* Determine whether the modules are enabled before sleeping, and use that result
|
||||
both here, and after wakeup to avoid double acquire or release of the GIL */
|
||||
serverTL->modulesEnabledThisAeLoop = !!moduleCount();
|
||||
@ -7205,7 +7206,9 @@ void OnTerminate()
|
||||
|
||||
void wakeTimeThread() {
|
||||
updateCachedTime();
|
||||
aeThreadOffline();
|
||||
std::unique_lock<fastlock> lock(time_thread_lock);
|
||||
aeThreadOnline();
|
||||
if (sleeping_threads >= cserver.cthreads)
|
||||
time_thread_cv.notify_one();
|
||||
sleeping_threads--;
|
||||
@ -7220,7 +7223,9 @@ void *timeThreadMain(void*) {
|
||||
aeThreadOnline();
|
||||
while (true) {
|
||||
{
|
||||
aeThreadOffline();
|
||||
std::unique_lock<fastlock> lock(time_thread_lock);
|
||||
aeThreadOnline();
|
||||
if (sleeping_threads >= cserver.cthreads) {
|
||||
aeThreadOffline();
|
||||
time_thread_cv.wait(lock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user