Boost logo

Boost Users :

Subject: [Boost-users] [chrono] this_thread::sleep_for milliseconds
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-09-04 18:44:58


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


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