* Initialize timeout module. * * This must be called in every process that wants to use timeouts. * * If the process was forked from another one that was also using this * module, be sure to call this before re-enabling signals; else handlers * meant to run in the parent process might get invoked in this one. */
| 445 | * meant to run in the parent process might get invoked in this one. |
| 446 | */ |
| 447 | void |
| 448 | InitializeTimeouts(void) |
| 449 | { |
| 450 | int i; |
| 451 | |
| 452 | /* Initialize, or re-initialize, all local state */ |
| 453 | disable_alarm(); |
| 454 | |
| 455 | num_active_timeouts = 0; |
| 456 | |
| 457 | for (i = 0; i < MAX_TIMEOUTS; i++) |
| 458 | { |
| 459 | all_timeouts[i].index = i; |
| 460 | all_timeouts[i].active = false; |
| 461 | all_timeouts[i].indicator = false; |
| 462 | all_timeouts[i].timeout_handler = NULL; |
| 463 | all_timeouts[i].start_time = 0; |
| 464 | all_timeouts[i].fin_time = 0; |
| 465 | } |
| 466 | |
| 467 | all_timeouts_initialized = true; |
| 468 | |
| 469 | /* Now establish the signal handler */ |
| 470 | pqsignal(SIGALRM, handle_sig_alarm); |
| 471 | } |
| 472 | |
| 473 | /* |
| 474 | * Register a timeout reason |
no test coverage detected