| 1352 | enum { CBM_SPAWN_BACKOFF_BASE_MS = 10, CBM_SPAWN_BACKOFF_MAX_SHIFT = 8 }; |
| 1353 | |
| 1354 | static void cbm_spawn_backoff(int attempt) { |
| 1355 | int shift = attempt < CBM_SPAWN_BACKOFF_MAX_SHIFT ? attempt : CBM_SPAWN_BACKOFF_MAX_SHIFT; |
| 1356 | long ms = (long)CBM_SPAWN_BACKOFF_BASE_MS << shift; |
| 1357 | struct timespec delay = {ms / 1000L, (ms % 1000L) * 1000L * 1000L}; |
| 1358 | (void)cbm_nanosleep_full(&delay); |
| 1359 | } |
| 1360 | |
| 1361 | /* fork() fails with EAGAIN under the same pressure posix_spawn does, and the |
| 1362 | * fallback path must not be less robust than the primary one. */ |
no test coverage detected