mdbx-tests: остановка/отстрел дочерних процессов с ожиданием.

Основная цель = обеспечить формирование логов без обрезания хвостов, в том числе при использовании дублирования (tee) и компрессии (lz4/gzip).
This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2025-06-18 11:37:06 +03:00
parent a9d910e8fd
commit d14927366d

View File

@ -381,7 +381,28 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
actor_status osal_actor_info(const mdbx_pid_t pid) { return children.at(pid); } actor_status osal_actor_info(const mdbx_pid_t pid) { return children.at(pid); }
static void wait_actors(unsigned timeout) {
for (auto &pair : children)
if (pair.second <= as_running) {
osal_yield();
mdbx_pid_t pid = 0;
osal_actor_poll(pid, timeout);
if (!pid)
return;
}
}
void osal_killall_actors(void) { void osal_killall_actors(void) {
for (auto &pair : children)
kill(pair.first, SIGINT);
wait_actors(0);
for (auto &pair : children) {
osal_yield();
kill(pair.first, SIGTERM);
}
wait_actors(1);
for (auto &pair : children) { for (auto &pair : children) {
kill(pair.first, SIGKILL); kill(pair.first, SIGKILL);
pair.second = as_killed; pair.second = as_killed;