MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / watcher_test_wait_pid

Function watcher_test_wait_pid

tests/test_watcher.c:884–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

882}
883
884static 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
901static bool watcher_test_wait_complete(atomic_bool *completed, uint64_t deadline_ms) {
902 while (cbm_now_ms() < deadline_ms) {

Callers 1

test_watcher.cFile · 0.85

Calls 2

cbm_now_msFunction · 0.85
cbm_fopenFunction · 0.85

Tested by

no test coverage detected