tgockel / zookeeper-cpp

A ZooKeeper client for C++.
http://tgockel.github.io/zookeeper-cpp/
Apache License 2.0
148 stars 40 forks source link

server: Do not spin in `server::run_process`. #84

Closed tgockel closed 6 years ago

tgockel commented 6 years ago

Creates a helper class for ::eventfd and uses ::select on STDOUT and STDERR of the subprocess and the shutdown event instead of spinning. It also drains the STDOUT and STDERR pipes after the process is fully terminated and reaped, so the last bits of subprocess output will no longer be lost.

This also might fix some of the server-not-dying issues I have seen intermittenly due to a misuse of POSIX ::kill. Unclear, though...

Fixes issue #82.