diff options
author | Robert Haas <rhaas@postgresql.org> | 2021-09-30 12:04:50 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2021-10-25 11:33:44 -0400 |
commit | 732e6677a667c03b1551a855e3216644b0f125ec (patch) | |
tree | beae396a87ef08adad6d3e76b1e238d07e0aa9b0 /src/include/utils/timeout.h | |
parent | 902a2c280012557b85c7e0fce3f6f0e355cb2d69 (diff) | |
download | postgresql-732e6677a667c03b1551a855e3216644b0f125ec.tar.gz postgresql-732e6677a667c03b1551a855e3216644b0f125ec.zip |
Add enable_timeout_every() to fire the same timeout repeatedly.
enable_timeout_at() and enable_timeout_after() can still be used
when you want to fire a timeout just once.
Patch by me, per a suggestion from Tom Lane.
Discussion: http://postgr.es/m/2992585.1632938816@sss.pgh.pa.us
Discussion: http://postgr.es/m/CA+TgmoYqSF5sCNrgTom9r3Nh=at4WmYFD=gsV-omStZ60S0ZUQ@mail.gmail.com
Diffstat (limited to 'src/include/utils/timeout.h')
-rw-r--r-- | src/include/utils/timeout.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h index 93e6a691b3f..1b13ac96e0e 100644 --- a/src/include/utils/timeout.h +++ b/src/include/utils/timeout.h @@ -48,14 +48,15 @@ typedef void (*timeout_handler_proc) (void); typedef enum TimeoutType { TMPARAM_AFTER, - TMPARAM_AT + TMPARAM_AT, + TMPARAM_EVERY } TimeoutType; typedef struct { TimeoutId id; /* timeout to set */ TimeoutType type; /* TMPARAM_AFTER or TMPARAM_AT */ - int delay_ms; /* only used for TMPARAM_AFTER */ + int delay_ms; /* only used for TMPARAM_AFTER/EVERY */ TimestampTz fin_time; /* only used for TMPARAM_AT */ } EnableTimeoutParams; @@ -75,6 +76,8 @@ extern void reschedule_timeouts(void); /* timeout operation */ extern void enable_timeout_after(TimeoutId id, int delay_ms); +extern void enable_timeout_every(TimeoutId id, TimestampTz fin_time, + int delay_ms); extern void enable_timeout_at(TimeoutId id, TimestampTz fin_time); extern void enable_timeouts(const EnableTimeoutParams *timeouts, int count); extern void disable_timeout(TimeoutId id, bool keep_indicator); |