23 : nextTimeout_(
TimePoint::
max()), loopController_(loopController) {}
26 std::function<
void()>
f,
30 if (bucket.first == duration) {
31 return *bucket.second;
35 timeoutHandleBuckets_.emplace_back(
36 duration, std::make_unique<TimeoutHandleList>());
37 return *timeoutHandleBuckets_.back().second;
48 return reinterpret_cast<intptr_t
>(&
list.back());
64 auto&
list = *bucket.second;
66 while (!
list.empty()) {
67 if (!
list.front().canceled) {
86 std::weak_ptr<TimeoutController> timeoutControllerWeak = shared_from_this();
89 [timeoutControllerWeak,
time]() {
90 if (
auto timeoutController = timeoutControllerWeak.lock()) {
91 timeoutController->runTimeouts(
time);
101 auto&
list = handle->list;
103 while (!
list.empty() &&
list.front().canceled) {
LoopController & loopController_
constexpr detail::Map< Move > move
std::chrono::steady_clock::time_point now()
virtual void timedSchedule(std::function< void()> func, TimePoint time)=0
—— Concurrent Priority Queue Implementation ——
std::vector< std::pair< Duration, TimeoutHandleListPtr > > timeoutHandleBuckets_
void runTimeouts(TimePoint time)
Encoder::MutableCompressedList list
intptr_t registerTimeout(std::function< void()> f, Duration duration)
TimeoutController(LoopController &loopController)
std::queue< TimeoutHandle > TimeoutHandleList
std::chrono::nanoseconds time()
std::chrono::time_point< Clock > TimePoint