Boost logo

Boost Users :

Subject: Re: [Boost-users] AsIO daytime example needs terminate code
From: Boris Schaeling (boris_at_[hidden])
Date: 2010-04-28 19:00:36


On Wed, 28 Apr 2010 23:47:13 +0200, Christopher Yeleighton
<giecrilj_at_[hidden]> wrote:

> [...]So how do I handle signals without breaking something?

You could for example create a pipe and write to it in the signal handler
(write is a function you can call in a signal handler). Somewhere else in
your program you read from the pipe (as you use Boost.Asio anyway eg. with
boost::asio::posix::stream_descriptor). If read returns you know it's time
to shutdown the server. And as you are not in a signal handler anymore you
can call io_service::stop.

Boris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net