69#define disable_alarm() (alarm_enabled = false)
70#define enable_alarm() (alarm_enabled = true)
182 if (fin_time < old_timeout->fin_time)
184 if (fin_time == old_timeout->
fin_time && id < old_timeout->
index)
240 if (
now > nearest_timeout)
256 if (secs == 0 && usecs == 0)
347 elog(
FATAL,
"could not enable SIGALRM timer: %m");
431 if (new_fin_time <
now)
519 (
errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
520 errmsg(
"cannot add more timeout reasons")));
641 for (
i = 0;
i < count;
i++)
646 switch (timeouts[
i].
type)
650 timeouts[
i].delay_ms);
660 timeouts[
i].delay_ms);
665 elog(
ERROR,
"unrecognized timeout type %d",
666 (
int) timeouts[
i].
type);
728 for (
i = 0;
i < count;
i++)
737 if (!timeouts[
i].keep_indicator)
768 if (!keep_indicators)
void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
TimestampTz GetCurrentTimestamp(void)
Datum now(PG_FUNCTION_ARGS)
#define Assert(condition)
#define MemSet(start, val, len)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void SetLatch(Latch *latch)
#define RESUME_INTERRUPTS()
#define HOLD_INTERRUPTS()
pqsigfunc pqsignal(int signo, pqsigfunc func)
timeout_handler_proc timeout_handler
static int find_active_timeout(TimeoutId id)
void enable_timeout_after(TimeoutId id, int delay_ms)
void reschedule_timeouts(void)
bool get_timeout_active(TimeoutId id)
void disable_all_timeouts(bool keep_indicators)
static timeout_params *volatile active_timeouts[MAX_TIMEOUTS]
static bool all_timeouts_initialized
TimestampTz get_timeout_finish_time(TimeoutId id)
void InitializeTimeouts(void)
static volatile TimestampTz signal_due_at
TimestampTz get_timeout_start_time(TimeoutId id)
void enable_timeout_every(TimeoutId id, TimestampTz fin_time, int delay_ms)
static void handle_sig_alarm(SIGNAL_ARGS)
static timeout_params all_timeouts[MAX_TIMEOUTS]
static volatile sig_atomic_t alarm_enabled
static void insert_timeout(TimeoutId id, int index)
static volatile sig_atomic_t signal_pending
struct timeout_params timeout_params
void enable_timeout_at(TimeoutId id, TimestampTz fin_time)
static void enable_timeout(TimeoutId id, TimestampTz now, TimestampTz fin_time, int interval_in_ms)
void disable_timeout(TimeoutId id, bool keep_indicator)
static volatile int num_active_timeouts
void enable_timeouts(const EnableTimeoutParams *timeouts, int count)
TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler)
static void schedule_alarm(TimestampTz now)
void disable_timeouts(const DisableTimeoutParams *timeouts, int count)
static void remove_timeout_index(int index)
bool get_timeout_indicator(TimeoutId id, bool reset_indicator)
void(* timeout_handler_proc)(void)
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
#define TimestampTzPlusMilliseconds(tz, ms)