mirror of
https://github.com/isar/libmdbx.git
synced 2025-06-23 01:42:36 +08:00
mdbx-tests: остановка/отстрел дочерних процессов с ожиданием.
Основная цель = обеспечить формирование логов без обрезания хвостов, в том числе при использовании дублирования (tee) и компрессии (lz4/gzip).
This commit is contained in:
parent
a9d910e8fd
commit
d14927366d
@ -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); }
|
||||
|
||||
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) {
|
||||
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) {
|
||||
kill(pair.first, SIGKILL);
|
||||
pair.second = as_killed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user