1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
This commit is contained in:
Jörg Thalheim 2025-06-14 15:38:23 +03:00 committed by GitHub
commit 4a4c1044fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@
#include <cmath>
#include <regex>
#include <unordered_set>
#include <sys/wait.h>
#include <thread>
#include <dirent.h>
@ -101,6 +102,11 @@ static CgroupStats destroyCgroup(const std::filesystem::path & cgroup, bool retu
// FIXME: pid wraparound
if (kill(pid, SIGKILL) == -1 && errno != ESRCH)
throw SysError("killing member %d of cgroup '%s'", pid, cgroup);
while (waitpid(pid, nullptr, 0) == -1) {
if (errno == ECHILD) break; // Process already reaped
if (errno != EINTR) throw SysError("waiting for pid %d", pid);
}
}
auto sleep = std::chrono::milliseconds((int) std::pow(2.0, std::min(round, 10)));