| 67 | } |
| 68 | |
| 69 | void timer::cancel() { |
| 70 | if (!static_cast<bool>(m_state)) { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | auto state = std::move(m_state); |
| 75 | state->cancel(); |
| 76 | |
| 77 | auto timer_queue = state->get_timer_queue().lock(); |
| 78 | |
| 79 | if (!static_cast<bool>(timer_queue)) { |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | timer_queue->remove_internal_timer(std::move(state)); |
| 84 | } |
| 85 | |
| 86 | void timer::set_frequency(std::chrono::milliseconds new_frequency) { |
| 87 | throw_if_empty(details::consts::k_timer_empty_set_frequency_err_msg); |