Cancel and dequeue operations for the given timer.
| 182 | |
| 183 | // Cancel and dequeue operations for the given timer. |
| 184 | std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops, |
| 185 | std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()) |
| 186 | { |
| 187 | std::size_t num_cancelled = 0; |
| 188 | if (timer.prev_ != 0 || &timer == timers_) |
| 189 | { |
| 190 | while (wait_op* op = (num_cancelled != max_cancelled) |
| 191 | ? timer.op_queue_.front() : 0) |
| 192 | { |
| 193 | op->ec_ = boost::asio::error::operation_aborted; |
| 194 | timer.op_queue_.pop(); |
| 195 | ops.push(op); |
| 196 | ++num_cancelled; |
| 197 | } |
| 198 | if (timer.op_queue_.empty()) |
| 199 | remove_timer(timer); |
| 200 | } |
| 201 | return num_cancelled; |
| 202 | } |
| 203 | |
| 204 | // Cancel and dequeue a specific operation for the given timer. |
| 205 | void cancel_timer_by_key(per_timer_data* timer, |