PostgreSQL Source Code: src/backend/utils/misc/timeout.c File Reference (original) (raw)

Go to the source code of this file.
◆ disable_alarm
◆ enable_alarm
◆ timeout_params
◆ disable_all_timeouts()
| void disable_all_timeouts | ( | bool | keep_indicators | ) |
|---|
Definition at line 751 of file timeout.c.
752{
753 int i;
754
756
757
758
759
760
761
762
764
766 {
770 }
771}
static timeout_params all_timeouts[MAX_TIMEOUTS]
static volatile int num_active_timeouts
References timeout_params::active, all_timeouts, disable_alarm, fb(), i, timeout_params::indicator, MAX_TIMEOUTS, and num_active_timeouts.
Referenced by AutoVacLauncherMain(), pgarch_archiveXlog(), PostgresMain(), ResolveRecoveryConflictWithBufferPin(), and ResolveRecoveryConflictWithLock().
◆ disable_timeout()
Definition at line 685 of file timeout.c.
686{
687
690
691
693
694
697
698
699 if (!keep_indicator)
701
702
705}
TimestampTz GetCurrentTimestamp(void)
#define Assert(condition)
static int find_active_timeout(TimeoutId id)
static bool all_timeouts_initialized
static void schedule_alarm(TimestampTz now)
static void remove_timeout_index(int index)
References all_timeouts, all_timeouts_initialized, Assert, disable_alarm, fb(), find_active_timeout(), GetCurrentTimestamp(), timeout_params::indicator, num_active_timeouts, remove_timeout_index(), and schedule_alarm().
Referenced by AbortTransaction(), assign_transaction_timeout(), BackendInitialize(), CommitTransaction(), disable_startup_progress_timeout(), disable_statement_timeout(), enable_statement_timeout(), PerformAuthentication(), PostgresMain(), PrepareTransaction(), and ProcSleep().
◆ disable_timeouts()
Definition at line 718 of file timeout.c.
719{
720 int i;
721
723
724
726
727
728 for (i = 0; i < count; i++)
729 {
731
733
736
739 }
740
741
744}
References all_timeouts, all_timeouts_initialized, Assert, disable_alarm, fb(), find_active_timeout(), GetCurrentTimestamp(), i, timeout_params::indicator, num_active_timeouts, remove_timeout_index(), and schedule_alarm().
Referenced by LockErrorCleanup(), and ProcSleep().
◆ enable_timeout()
Definition at line 158 of file timeout.c.
160{
161 int i;
162
163
166
167
168
169
170
173
174
175
176
177
179 {
181
183 break;
185 break;
186 }
187
188
189
190
195
197}
Datum now(PG_FUNCTION_ARGS)
static timeout_params *volatile active_timeouts[MAX_TIMEOUTS]
static void insert_timeout(TimeoutId id, int index)
References active_timeouts, all_timeouts, all_timeouts_initialized, Assert, fb(), timeout_params::fin_time, find_active_timeout(), i, timeout_params::indicator, insert_timeout(), timeout_params::interval_in_ms, now(), num_active_timeouts, remove_timeout_index(), and timeout_params::start_time.
Referenced by enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), and handle_sig_alarm().
◆ enable_timeout_after()
Definition at line 560 of file timeout.c.
561{
564
565
567
568
572
573
575}
static void enable_timeout(TimeoutId id, TimestampTz now, TimestampTz fin_time, int interval_in_ms)
#define TimestampTzPlusMilliseconds(tz, ms)
References disable_alarm, enable_timeout(), GetCurrentTimestamp(), now(), schedule_alarm(), and TimestampTzPlusMilliseconds.
Referenced by assign_transaction_timeout(), BackendInitialize(), enable_statement_timeout(), PerformAuthentication(), PostgresMain(), ProcessInterrupts(), ProcSleep(), start_xact_command(), and StartTransaction().
◆ enable_timeout_at()
◆ enable_timeout_every()
◆ enable_timeouts()
Definition at line 630 of file timeout.c.
631{
633 int i;
634
635
637
638
640
641 for (i = 0; i < count; i++)
642 {
645
647 {
652 break;
653
656 break;
657
662 break;
663
664 default:
665 elog(ERROR, "unrecognized timeout type %d",
667 break;
668 }
669 }
670
671
673}
References disable_alarm, elog, enable_timeout(), ERROR, fb(), GetCurrentTimestamp(), i, now(), schedule_alarm(), TimestampTzPlusMilliseconds, TMPARAM_AFTER, TMPARAM_AT, TMPARAM_EVERY, and type.
Referenced by ProcSleep(), ResolveRecoveryConflictWithBufferPin(), and ResolveRecoveryConflictWithLock().
◆ find_active_timeout()
◆ get_timeout_active()
◆ get_timeout_finish_time()
◆ get_timeout_indicator()
◆ get_timeout_start_time()
◆ handle_sig_alarm()
Definition at line 364 of file timeout.c.
365{
366
367
368
369
370
372
373
374
375
376
378
379
380
381
382
384
385
386
387
389 {
390
391
392
393
394
396
398 {
400
401
404 {
406
407
409
410
412
413
415
416
418 {
420
421
422
423
424
425
426
427
437 }
438
439
440
441
442
443
445 }
446
447
449 }
450 }
451
453}
void SetLatch(Latch *latch)
#define RESUME_INTERRUPTS()
#define HOLD_INTERRUPTS()
static volatile sig_atomic_t alarm_enabled
static volatile sig_atomic_t signal_pending
References active_timeouts, alarm_enabled, disable_alarm, enable_timeout(), fb(), GetCurrentTimestamp(), HOLD_INTERRUPTS, MyLatch, now(), num_active_timeouts, remove_timeout_index(), RESUME_INTERRUPTS, schedule_alarm(), SetLatch(), signal_pending, and TimestampTzPlusMilliseconds.
Referenced by InitializeTimeouts().
◆ InitializeTimeouts()
Definition at line 470 of file timeout.c.
471{
472 int i;
473
474
476
478
480 {
488 }
489
491
492
494}
timeout_handler_proc timeout_handler
static void handle_sig_alarm(SIGNAL_ARGS)
References timeout_params::active, all_timeouts, all_timeouts_initialized, disable_alarm, fb(), timeout_params::fin_time, handle_sig_alarm(), i, timeout_params::index, timeout_params::indicator, timeout_params::interval_in_ms, MAX_TIMEOUTS, num_active_timeouts, pqsignal, SIGALRM, timeout_params::start_time, and timeout_params::timeout_handler.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackendInitialize(), BackgroundWorkerMain(), PostgresMain(), ReplSlotSyncWorkerMain(), StartupProcessMain(), and WalSndSignals().
◆ insert_timeout()
Definition at line 114 of file timeout.c.
115{
116 int i;
117
119 elog(FATAL, "timeout index %d out of range 0..%d", index,
121
124
127
129
131}
References timeout_params::active, active_timeouts, all_timeouts, Assert, elog, FATAL, fb(), i, and num_active_timeouts.
Referenced by enable_timeout().
◆ RegisterTimeout()
Definition at line 505 of file timeout.c.
506{
508
509
510
512 {
513
516 break;
520 errmsg("cannot add more timeout reasons")));
521 }
522
524
526
527 return id;
528}
int errcode(int sqlerrcode)
#define ereport(elevel,...)
References all_timeouts, all_timeouts_initialized, Assert, ereport, errcode(), errmsg, FATAL, fb(), MAX_TIMEOUTS, timeout_params::timeout_handler, and USER_TIMEOUT.
Referenced by BackendInitialize(), InitPostgres(), StartupProcessMain(), and StartupXLOG().
◆ remove_timeout_index()
Definition at line 137 of file timeout.c.
138{
139 int i;
140
142 elog(FATAL, "timeout index %d out of range 0..%d", index,
144
147
150
152}
References timeout_params::active, active_timeouts, Assert, elog, FATAL, fb(), i, and num_active_timeouts.
Referenced by disable_timeout(), disable_timeouts(), enable_timeout(), and handle_sig_alarm().
◆ reschedule_timeouts()
◆ schedule_alarm()
Definition at line 210 of file timeout.c.
211{
213 {
218
220
221
222
223
224
225
226
227
228
229
232
233
234
235
236
237
238
241 {
243
246 }
247 else
248 {
251
252
253
254
255
258 }
259
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
317 return;
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
337
338
340 {
341
342
343
344
345
347 elog(FATAL, "could not enable SIGALRM timer: %m");
348 }
349 }
350}
void TimestampDifference(TimestampTz start_time, TimestampTz stop_time, long *secs, int *microsecs)
#define MemSet(start, val, len)
static volatile TimestampTz signal_due_at
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
References active_timeouts, elog, enable_alarm, FATAL, fb(), timeout_params::fin_time, ITIMER_REAL, MemSet, now(), num_active_timeouts, setitimer(), signal_due_at, signal_pending, and TimestampDifference().
Referenced by disable_timeout(), disable_timeouts(), enable_timeout_after(), enable_timeout_at(), enable_timeout_every(), enable_timeouts(), handle_sig_alarm(), and reschedule_timeouts().
◆ active_timeouts
◆ alarm_enabled
◆ all_timeouts
Definition at line 45 of file timeout.c.
Referenced by disable_all_timeouts(), disable_timeout(), disable_timeouts(), enable_timeout(), get_timeout_active(), get_timeout_finish_time(), get_timeout_indicator(), get_timeout_start_time(), InitializeTimeouts(), insert_timeout(), and RegisterTimeout().
◆ all_timeouts_initialized
◆ num_active_timeouts
Definition at line 52 of file timeout.c.
Referenced by disable_all_timeouts(), disable_timeout(), disable_timeouts(), enable_timeout(), find_active_timeout(), handle_sig_alarm(), InitializeTimeouts(), insert_timeout(), remove_timeout_index(), reschedule_timeouts(), and schedule_alarm().