feat update
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Successful in 1m45s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m51s
linux-arm-gcc / linux-gcc-armhf (push) Successful in 2m18s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m19s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m21s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 2m24s

This commit is contained in:
tqcq 2024-05-01 14:27:02 +08:00
parent 7100bcf163
commit 3da9625ce2
2 changed files with 12 additions and 17 deletions

View File

@ -54,14 +54,6 @@ private:
scoped_refptr<PendingTaskSafetyFlag> flag_; scoped_refptr<PendingTaskSafetyFlag> flag_;
}; };
// inline std::function<void()>
// SafeTask(scoped_refptr<PendingTaskSafetyFlag> flag, std::function<void()> task)
// {
// return [flag, task]() mutable {
// if (flag->alive()) { std::move(task)(); }
// };
// }
template<typename F, typename... Args, typename = EnableIfT<!std::is_void<InvokeResultT<F, Args...>>::value>> template<typename F, typename... Args, typename = EnableIfT<!std::is_void<InvokeResultT<F, Args...>>::value>>
std::function<InvokeResultT<F, Args...>(Args &&...)> std::function<InvokeResultT<F, Args...>(Args &&...)>
SafeTask(scoped_refptr<PendingTaskSafetyFlag> flag, F &&f) SafeTask(scoped_refptr<PendingTaskSafetyFlag> flag, F &&f)

View File

@ -86,8 +86,11 @@ TimerManager::CreateTimer(const std::string &name, Timer::OnExpired on_expired)
std::unique_ptr<Timeout> timeout = timeout_creator_(sled::TaskQueueBase::DelayPrecision::kHigh); std::unique_ptr<Timeout> timeout = timeout_creator_(sled::TaskQueueBase::DelayPrecision::kHigh);
auto timer = std::unique_ptr<Timer>(new Timer( auto timer = std::unique_ptr<Timer>(new Timer(
id, name, std::move(on_expired), id,
/* ungrgister_handler=*/[this, id]() { timers_.erase(id); }, std::move(timeout))); name,
std::move(on_expired),
/* ungrgister_handler=*/[this, id]() { timers_.erase(id); },
std::move(timeout)));
timers_[id] = timer.get(); timers_[id] = timer.get();
return timer; return timer;
} }