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

Function cbm_spawn_backoff

src/foundation/subprocess.c:969–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967enum { CBM_SPAWN_BACKOFF_BASE_MS = 10, CBM_SPAWN_BACKOFF_MAX_SHIFT = 8 };
968
969static void cbm_spawn_backoff(int attempt) {
970 int shift = attempt < CBM_SPAWN_BACKOFF_MAX_SHIFT ? attempt : CBM_SPAWN_BACKOFF_MAX_SHIFT;
971 long ms = (long)CBM_SPAWN_BACKOFF_BASE_MS << shift;
972 struct timespec delay = {ms / 1000L, (ms % 1000L) * 1000L * 1000L};
973 (void)cbm_nanosleep(&delay, NULL);
974}
975
976/* fork() fails with EAGAIN under the same pressure posix_spawn does, and the
977 * fallback path must not be less robust than the primary one. */

Callers 2

cbm_fork_with_retryFunction · 0.85

Calls 1

cbm_nanosleepFunction · 0.85

Tested by

no test coverage detected