
Rob Stewart <robertstewart@comcast.net> writes:
On Nov 14, 2012, at 7:09 PM, "Boris Schaeling" <boris@highscore.de> wrote:
To wait asynchronously on POSIX I use boost::asio::signal_set to register a signal handler for SIGCHLD. This is a global setting and must be done before a child process is created (actually exits). To wait asynchronously on Windows I use boost::asio::windows::object_handle to wait on a child process handle. This is a per-child setting and can only be done after the child process has been created (as only then we have the handle to wait on). For a cross-platform solution we would need to merge these two concepts somehow: A global setting before child processes are created on POSIX and a per-child setting after child processes are created on Windows. Here POSIX and Windows are unfortunately totally different.
How about a global setting and then have the child class, on Windows, inspect that setting to decide whether to add the per-child wait?
I was also going to suggest something like this. Yes, it is a lowest-common-denominator solution but that's the price you pay for portability. Alex