| 967 | enum { CBM_SPAWN_BACKOFF_BASE_MS = 10, CBM_SPAWN_BACKOFF_MAX_SHIFT = 8 }; |
| 968 | |
| 969 | static 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. */ |
no test coverage detected