MCPcopy Create free account
hub / github.com/apache/cloudberry / disable_timeouts

Function disable_timeouts

src/backend/utils/misc/timeout.c:666–693  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

664 * and setitimer() calls needed to cancel multiple timeouts.
665 */
666void
667disable_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,

Callers 4

LockErrorCleanupFunction · 0.85
ProcSleepFunction · 0.85
ResProcSleepFunction · 0.85
ResLockWaitCancelFunction · 0.85

Calls 4

remove_timeout_indexFunction · 0.85
find_active_timeoutFunction · 0.85
schedule_alarmFunction · 0.85
GetCurrentTimestampFunction · 0.85

Tested by

no test coverage detected