
Am 22.08.2012 00:35, schrieb Boris Schaeling:
On Sun, 19 Aug 2012 23:21:00 +0200, Oliver Kowalke <oliver.kowalke@gmx.de> wrote:
Hi Oliver,
How is asynch. signal handling done?
int status; boost::asio::signal_set set(io_service, SIGCHLD); set.async_wait( [&status](const boost::system::error_code&, int) { ::wait(&status); } );
Please note that on POSIX you are limited on what you can do inside a signal handler (must not call non-reentrant functions)! I suggest you do not invoke the callback from the user in the signal handler - instead you set inside the signal handler a flag indicating the io-demultiplexer (io_service) to call the associated callback if you have returned from the signal handler (io_service has to continue with dispatching).
I'm not sure whether I understand. Is this a general recommendation for others? Or you think there is something wrong with the code from the example?
I'm sorry - the signal handling (signal reactor) is implemented by asio. I've to take a look into its implementation. Sorry for the noise. Oliver