| 882 | } |
| 883 | |
| 884 | static bool watcher_test_wait_pid(const char *marker, uint64_t deadline_ms, pid_t *pid_out) { |
| 885 | while (cbm_now_ms() < deadline_ms) { |
| 886 | FILE *file = cbm_fopen(marker, "rb"); |
| 887 | long parsed = 0; |
| 888 | bool valid = file && fscanf(file, "%ld", &parsed) == 1 && parsed > 1 && parsed != getpid(); |
| 889 | if (file) { |
| 890 | (void)fclose(file); |
| 891 | } |
| 892 | if (valid) { |
| 893 | *pid_out = (pid_t)parsed; |
| 894 | return true; |
| 895 | } |
| 896 | cbm_usleep(1000); |
| 897 | } |
| 898 | return false; |
| 899 | } |
| 900 | |
| 901 | static bool watcher_test_wait_complete(atomic_bool *completed, uint64_t deadline_ms) { |
| 902 | while (cbm_now_ms() < deadline_ms) { |
no test coverage detected