* Cancel multiple timeouts at once. * * The timeouts' I've-been-fired indicators are reset, * unless timeouts[i].keep_indicator is true. * * This works like calling disable_timeout() multiple times. * Use this to reduce the number of GetCurrentTimestamp() * and setitimer() calls needed to cancel multiple timeouts. */
| 664 | * and setitimer() calls needed to cancel multiple timeouts. |
| 665 | */ |
| 666 | void |
| 667 | disable_timeouts(const DisableTimeoutParams *timeouts, int count) |
| 668 | { |
| 669 | int i; |
| 670 | |
| 671 | Assert(all_timeouts_initialized); |
| 672 | |
| 673 | /* Disable timeout interrupts for safety. */ |
| 674 | disable_alarm(); |
| 675 | |
| 676 | /* Cancel the timeout(s). */ |
| 677 | for (i = 0; i < count; i++) |
| 678 | { |
| 679 | TimeoutId id = timeouts[i].id; |
| 680 | |
| 681 | Assert(all_timeouts[id].timeout_handler != NULL); |
| 682 | |
| 683 | if (all_timeouts[id].active) |
| 684 | remove_timeout_index(find_active_timeout(id)); |
| 685 | |
| 686 | if (!timeouts[i].keep_indicator) |
| 687 | all_timeouts[id].indicator = false; |
| 688 | } |
| 689 | |
| 690 | /* Reschedule the interrupt, if any timeouts remain active. */ |
| 691 | if (num_active_timeouts > 0) |
| 692 | schedule_alarm(GetCurrentTimestamp()); |
| 693 | } |
| 694 | |
| 695 | /* |
| 696 | * Disable the signal handler, remove all timeouts from the active list, |
no test coverage detected