On 12/08/2014 04:14, Halim DJERROUD wrote:[...]
I try to intercept real-time signals (SIGMIN + 1, SIGMIN +2 ...) it
works when I send a signal (kill -35 PID)
it works well only if i send one signal, when i send another signal or
same signal second time (kill -35 PID) the pogram does not intercept
the signal
I'm assuming that's a typo.
#define SIG1 (SIGRTMIN + 1)
#define SIG1 (SIGRTMIN + 2)
async_wait is an operation that will wait for a single signal and then call the hander. Once this has been done, the operation is complete.
signals.async_wait( boost::bind(&Agent::signal_handler, this,
boost::asio::placeholders::error,
boost::asio::placeholders::signal_number));
io_serv.run();
for (;;) {
std::this_thread::yield();
}
If you want to be able to catch multiple signals, you need to call async_wait again within your signal handler to start a new operation.
You can either call async_wait at the top of your signal handler to potentially process signals in parallel (if you have more than one io_service thread), or you can call it at the bottom to ensure that signals cannot be processed concurrently (albeit possibly not on the same thread, again).
Also bear in mind that your threads implementation might be using some of the RT signals already, so make sure you don't collide with them.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users