| 576 | } |
| 577 | |
| 578 | static bool client_start_parent_watchdog(pid_t initial_ppid) { |
| 579 | if (initial_ppid <= 1) { |
| 580 | return true; |
| 581 | } |
| 582 | static parent_watchdog_config_t client_config; |
| 583 | client_config.initial_ppid = initial_ppid; |
| 584 | client_config.kill_worker_group = false; |
| 585 | client_config.exit_on_parent_death = true; |
| 586 | cbm_thread_t watchdog; |
| 587 | if (cbm_thread_create(&watchdog, PARENT_WATCHDOG_STACK_SIZE, parent_watchdog_thread, |
| 588 | &client_config) != 0) { |
| 589 | return false; |
| 590 | } |
| 591 | if (cbm_thread_detach(&watchdog) != 0) { |
| 592 | atomic_store(&g_shutdown, 1); |
| 593 | (void)cbm_thread_join(&watchdog); |
| 594 | return false; |
| 595 | } |
| 596 | return true; |
| 597 | } |
| 598 | #else /* _WIN32 */ |
| 599 | /* Windows parent-death watchdog — the #914 half of the story. |
| 600 | * |
no test coverage detected