extending asio with unix signal handlers

Hi, What do you think of extending asio with unix signal handling? The extension lets the library user to have a handler invoked when a unix signal arrives. void on_signal(boost::system::error_code const& error) { if (!error) cout << "sigint received" << endl; } int main(int argc, char const* argv[]) { boost::asio::io_service ios; boost::asio::posix::signal_handler<SIGINT> sigint(ios); while (true) { ios.reset(); sigint.async_wait(boost::bind(on_signal, _1)); ios.poll(); } } This lets the user have a unix signal handler of an arbitrary signature. This also removes the "async-signal safe calls" restriction. Please, find the implementation along with two examples enclosed. BR, Dmitry

On Thu, Mar 19, 2009 at 9:55 AM, Dmitry Goncharov <dgoncharov@unison.com> wrote:
Hi,
What do you think of extending asio with unix signal handling? The extension lets the library user to have a handler invoked when a unix signal arrives.
I'm interested. I think you should open a ticket . -- gpd

Giovanni Piero Deretta wrote:
On Thu, Mar 19, 2009 at 9:55 AM, Dmitry Goncharov <dgoncharov@unison.com> wrote:
Hi,
What do you think of extending asio with unix signal handling? The extension lets the library user to have a handler invoked when a unix signal arrives.
I'm interested. I think you should open a ticket .
I opened ticket#2879 and assigned it to Chris Kohlhoff. I also sent the same proposal directly to Chris. Didn't get a response though. Any suggestions on what else (besides a ticket) can be done to have the extension included? A ticket doesn't seem to be enough. BR, Dmitry

On Thu, Mar 19, 2009 at 4:55 PM, Dmitry Goncharov <dgoncharov@unison.com> wrote:
Hi,
What do you think of extending asio with unix signal handling?
I think it's brilliant.
The extension lets the library user to have a handler invoked when a unix signal arrives.
Sweet. Perfect. I think this is exactly what I've been looking for. :-)
This lets the user have a unix signal handler of an arbitrary signature. This also removes the "async-signal safe calls" restriction.
Please, find the implementation along with two examples enclosed.
Thanks for this Dmitry! -- Dean Michael Berris | Software Engineer, Friendster, Inc. blog.cplusplus-soup.com | twitter.com/mikhailberis | linkedin.com/in/mikhailberis | profiles.friendster.com/mikhailberis | deanberris.com
participants (4)
-
Dean Michael Berris
-
Dmitry Goncharov
-
Giovanni Piero Deretta
-
kjell_elster@hotmail.com