update sigh

This commit is contained in:
udo
2022-12-22 06:01:23 +00:00
parent 392b7224b1
commit 984453f336
24 changed files with 387 additions and 474 deletions
+14
View File
@@ -491,6 +491,20 @@ pid_t task(String key, std::function<void()> exec_after_spawn, u64 timeout)
}
}
#include <unistd.h>
pid_t task_repeat(String key, u64 interval, std::function<void()> exec_after_spawn, u64 timeout)
{
auto repeater_function = [&]() {
while (true)
{
exec_after_spawn();
printf("(P) worker process '%s' sleeping\n", key.c_str());
usleep((s64)(interval*1000000));
}
};
return(task(key, repeater_function, timeout));
}
void on_child_exit(int sig)
{
pid_t pid;