fix delete do while
Some checks failed
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m20s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m22s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m24s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m29s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m30s
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 3h14m12s
linux-x64-gcc / linux-gcc (push) Failing after 3h14m10s

This commit is contained in:
tqcq 2024-03-05 16:07:49 +08:00
parent ae88a7e4fb
commit 9023145485

View File

@ -94,7 +94,7 @@ TimerManager::Loop()
{
while (!stopped_) {
// ULOG_TRACE("system.timer_manager", "now: {}", TimeNowInMicroSeconds());
Thread::Sleep(1);
// Thread::Sleep(1);
MutexGuard timers_guard(timers_lock_);
// add timer
{
@ -126,15 +126,14 @@ TimerManager::Loop()
if (timers_.empty()) {
timers_cond_.WaitForMilliseconds(timers_guard, 1000);
} else if (timers_.begin()->first > now) {
do {
// do {
uint64_t wait_time_ms = (timers_.begin()->first - now + 1000) / 1000;
// FIX:
if (wait_time_ms < 100) { wait_time_ms = 100; }
wait_time_ms += 1;
// if (wait_time_ms < 100) { wait_time_ms = 100; }
timers_cond_.WaitForMilliseconds(timers_guard, wait_time_ms);
now = TimeNowInMicroSeconds();
} while (timers_.begin()->first > now);
// } while (timers_.begin()->first >= now);
} else {
ULOG_TRACE("system.timer_manager", "need trigger set size: {}", timers_.size());
std::set<Entry> expired_timers;