aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/timeout.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2021-09-30 12:04:50 -0400
committerRobert Haas <rhaas@postgresql.org>2021-10-25 11:33:44 -0400
commit732e6677a667c03b1551a855e3216644b0f125ec (patch)
treebeae396a87ef08adad6d3e76b1e238d07e0aa9b0 /src/include/utils/timeout.h
parent902a2c280012557b85c7e0fce3f6f0e355cb2d69 (diff)
downloadpostgresql-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.h7
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);