Timer::TimerThreadProc(): don't unnecessarily unlock and lock l_TimerMutex

This commit is contained in:
Alexander A. Klimov 2023-03-21 15:51:20 +01:00
parent 1badbab002
commit 13b9cfda41
1 changed files with 4 additions and 2 deletions

View File

@ -292,9 +292,9 @@ void Timer::TimerThreadProc()
Utility::SetThreadName("Timer Thread"); Utility::SetThreadName("Timer Thread");
for (;;) { std::unique_lock<std::mutex> lock (l_TimerMutex);
std::unique_lock<std::mutex> lock(l_TimerMutex);
for (;;) {
typedef boost::multi_index::nth_index<TimerSet, 1>::type NextTimerView; typedef boost::multi_index::nth_index<TimerSet, 1>::type NextTimerView;
NextTimerView& idx = boost::get<1>(l_Timers); NextTimerView& idx = boost::get<1>(l_Timers);
@ -339,5 +339,7 @@ void Timer::TimerThreadProc()
/* Asynchronously call the timer. */ /* Asynchronously call the timer. */
Utility::QueueAsyncCallback([timer=std::move(keepAlive)]() { timer->Call(); }); Utility::QueueAsyncCallback([timer=std::move(keepAlive)]() { timer->Call(); });
lock.lock();
} }
} }