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

Function watcher_test_wait_pid

tests/test_watcher.c:1046–1061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044}
1045
1046static 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
1063static bool watcher_test_wait_complete(atomic_bool *completed, uint64_t deadline_ms) {
1064 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