Boost logo

Boost Users :

Subject: [Boost-users] [asio] Can deadline_timer and setitimer() coexist?
From: Nader Salehi (salehi_at_[hidden])
Date: 2010-06-14 17:18:57


Hi,

I was wondering if we could use setitimer() in a code base that
utilizes ASIO deadline_timer? I have a server code which uses ASIO
for various async operations --including a few async timers. It uses
io_service.run() in the main function to dispatch events. The server
needs to gracefully shutdown, meaning that it should finish all the
currently queue events. As an upper bound to the graceful shutdown, I
want to set a timer to guarantee the code will exit. Adding the
timer, howerver, as an ASIO deadline_timer will force the run()
function to wait until the shutdown timer expires. Using setitimer()
and handling SIGALRM looks like a better alternative for me. I think
it works, but I need to know whether there is no side effect to this.

Thanks,
Nader

PS. NO, I cannot use io_service.run_one() :)


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