* Cancel the specified timeout. * * The timeout's I've-been-fired indicator is reset, * unless keep_indicator is true. * * When a timeout is canceled, any other active timeout remains in force. * It's not an error to disable a timeout that is not enabled. */
| 631 | * It's not an error to disable a timeout that is not enabled. |
| 632 | */ |
| 633 | void |
| 634 | disable_timeout(TimeoutId id, bool keep_indicator) |
| 635 | { |
| 636 | /* Assert request is sane */ |
| 637 | Assert(all_timeouts_initialized); |
| 638 | Assert(all_timeouts[id].timeout_handler != NULL); |
| 639 | |
| 640 | /* Disable timeout interrupts for safety. */ |
| 641 | disable_alarm(); |
| 642 | |
| 643 | /* Find the timeout and remove it from the active list. */ |
| 644 | if (all_timeouts[id].active) |
| 645 | remove_timeout_index(find_active_timeout(id)); |
| 646 | |
| 647 | /* Mark it inactive, whether it was active or not. */ |
| 648 | if (!keep_indicator) |
| 649 | all_timeouts[id].indicator = false; |
| 650 | |
| 651 | /* Reschedule the interrupt, if any timeouts remain active. */ |
| 652 | if (num_active_timeouts > 0) |
| 653 | schedule_alarm(GetCurrentTimestamp()); |
| 654 | } |
| 655 | |
| 656 | /* |
| 657 | * Cancel multiple timeouts at once. |
no test coverage detected