Boost logo

Boost Users :

Subject: [Boost-users] boost asio daemon
From: Philipp Kraus (philipp.kraus_at_[hidden])
Date: 2013-04-16 10:08:13


Hello,

I use boost::asio for creating a daemon, I do this:

    io::io_service l_ioservice;
    io::signal_set l_signals(l_ioservice, SIGINT, SIGTERM);
    l_signals.async_wait(daemonhandler);
    l_ioservice.run();

my daemonhandler shows:

void daemonhandler( const boost::system::Error_code& err )
{
     if (!err)
          do some log
}

The daemon handler function is a function, that runs in a thread loop, does it?
Can I create something like:

void daemonhandler( const boost::system::Error_code& err )
{
     if (!err)
          do some log
     else
         do daemon work
}

My question is, is the daemonhandler function a function that is called only if the daemon is stopped or
that is run during the daemon is active / working?

Thanks

Phil



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