MCPcopy Create free account
hub / github.com/boostorg/asio / remove_timer

Method remove_timer

include/boost/asio/detail/timer_queue.hpp:294–327  ·  view source on GitHub ↗

Remove a timer from the heap and list of timers.

Source from the content-addressed store, hash-verified

292
293 // Remove a timer from the heap and list of timers.
294 void remove_timer(per_timer_data& timer)
295 {
296 // Remove the timer from the heap.
297 std::size_t index = timer.heap_index_;
298 if (!heap_.empty() && index < heap_.size())
299 {
300 if (index == heap_.size() - 1)
301 {
302 timer.heap_index_ = (std::numeric_limits<std::size_t>::max)();
303 heap_.pop_back();
304 }
305 else
306 {
307 swap_heap(index, heap_.size() - 1);
308 timer.heap_index_ = (std::numeric_limits<std::size_t>::max)();
309 heap_.pop_back();
310 if (index > 0 && TimeTraits::less_than(
311 heap_[index].time_, heap_[(index - 1) / 2].time_))
312 up_heap(index);
313 else
314 down_heap(index);
315 }
316 }
317
318 // Remove the timer from the linked list of active timers.
319 if (timers_ == &timer)
320 timers_ = timer.next_;
321 if (timer.prev_)
322 timer.prev_->next_ = timer.next_;
323 if (timer.next_)
324 timer.next_->prev_= timer.prev_;
325 timer.next_ = 0;
326 timer.prev_ = 0;
327 }
328
329 // Determine if the specified absolute time is positive infinity.
330 template <typename Time_Type>

Callers

nothing calls this directly

Calls 3

less_thanFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected