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

Function host_lifetime_reservation_acquire

src/daemon/host.c:278–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278static int host_lifetime_reservation_acquire(
279 const cbm_daemon_ipc_endpoint_t *endpoint,
280 cbm_daemon_ipc_lifetime_reservation_t **reservation_out) {
281#ifdef _WIN32
282 uint64_t now = cbm_now_ms();
283 uint64_t deadline = now > UINT64_MAX - HOST_WINDOWS_LIFETIME_ACQUIRE_MS
284 ? UINT64_MAX
285 : now + HOST_WINDOWS_LIFETIME_ACQUIRE_MS;
286 do {
287 int status = cbm_daemon_ipc_lifetime_reservation_try_acquire(endpoint, reservation_out);
288 if (status != 0) {
289 return status;
290 }
291 cbm_usleep(1000);
292 } while (cbm_now_ms() < deadline);
293 return 0;
294#else
295 return cbm_daemon_ipc_lifetime_reservation_try_acquire(endpoint, reservation_out);
296#endif
297}
298
299static void *host_watcher_thread(void *opaque) {
300 cbm_watcher_run(opaque, HOST_WATCH_INTERVAL_MS);

Callers 1

cbm_daemon_host_runFunction · 0.85

Calls 2

cbm_now_msFunction · 0.85

Tested by

no test coverage detected