Re: [ILUG] signals and c++

From: Caolan McNamara (cmc at domain stardivision.de)
Date: Wed 02 Feb 2000 - 11:43:50 GMT


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 02.02.00, 12:33:03, Brendan Kehoe <brendan at domain zen.org> wrote regarding
Re: [ILUG] signals and c++:

> > In the absence of such massive cleverness though I imagine that Im
> > just going to have to live with the ugliness of signals crapping all
> > over the destructors of a program, unless anyone has any cunning
> > ideas.

> Doug Schmidt had an interesting article in C++ Report a while ago
> (cf. http://www.cs.wustl.edu/~schmidt/signal-patterns.html) offering
one cool
> approach to making C++ code deal with Unix signals in an elegant way.
The
> stuff in his ``ACE wrappers'' package also offers a solution.

Hmm, it looks like the best practical approach, but it still has its
problems. A signal is caught and basically a flag set which gets
tested at some fixed point during the execution. So in his final
example if a SIGINT was received during do_work() then the program
would only shutdown after the do_work() thingy finished. So if the
program was stuck in do_work() you couldn't use a SIGINT to shutdown.
As the signal would be caught and its handing deferred until the
explicit test in the loop.

I'll just have to accept that you can't squish round pegs into square
holes and expect a perfect fit.

> B

> --
> Brendan Kehoe

> Web page: http://www.zen.org/~brendan/



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:05:20 GMT