| 1044 | } |
| 1045 | |
| 1046 | static bool watcher_test_wait_pid(const char *marker, uint64_t deadline_ms, pid_t *pid_out) { |
| 1047 | while (cbm_now_ms() < deadline_ms) { |
| 1048 | FILE *file = cbm_fopen(marker, "rb"); |
| 1049 | long parsed = 0; |
| 1050 | bool valid = file && fscanf(file, "%ld", &parsed) == 1 && parsed > 1 && parsed != getpid(); |
| 1051 | if (file) { |
| 1052 | (void)fclose(file); |
| 1053 | } |
| 1054 | if (valid) { |
| 1055 | *pid_out = (pid_t)parsed; |
| 1056 | return true; |
| 1057 | } |
| 1058 | cbm_usleep(1000); |
| 1059 | } |
| 1060 | return false; |
| 1061 | } |
| 1062 | |
| 1063 | static bool watcher_test_wait_complete(atomic_bool *completed, uint64_t deadline_ms) { |
| 1064 | while (cbm_now_ms() < deadline_ms) { |
no test coverage detected