I am writing a process manager that monitors its` child processes and restarts them if necessary.
Currently, I have pidfd
associated with every running process and epoll
waiting for all of these pidfd
s. When one process terminates, epoll_wait()
wakes up, and to determine the exit code of the process, I use blocking waitpid()
to determine my process` exit code (in my program it is necessary to determine, whether to restart the process or not).
I was wondering, whether there are any underlying problems with my solution, as I have to make my process manager as lock-free and safe as possible. My main concern is using waitpid()
after pidfd
becomes readable. Is it possible that this wait will lock my execution?
I would appreciate any help, insight, or feedback regarding my concern.