[chrono] this_thread::sleep_for milliseconds
Hello, I am working on a daemon that involves a sleep_for in the main loop, while worker-threads do the "heavier" lifting in the daemon. I have a couple of signals wired up to respond to terminal, kill or other requests, as per daemonization-guidelines. Question for the list, I gather that thread-sleeps are interrupted when these type of signals occur? Which is fine, I don't need to re-sleep, per se, as some examples seem to suggest. But I do guard a flag in a mutex-critical-section and flag whether to stop running the main loop, which then joins the worker threads. Is this about right as far as daemon, thread/sleep, worker thread approaches are concerned? It seems like it to me, but I thought I should run it past the list to see if there are any pearls of wisdom on the subject. Thank you... Regards, Michael Powell
On 09/05/2013 12:44 AM, Michael Powell wrote:
I am working on a daemon that involves a sleep_for in the main loop, while worker-threads do the "heavier" lifting in the daemon. I have a couple of signals wired up to respond to terminal, kill or other requests, as per daemonization-guidelines.
Have you considered using the Boost.Asio signal handling? http://www.boost.org/doc/html/boost_asio/overview/signals.html
participants (2)
-
Bjorn Reese
-
Michael Powell