Proposal: new signal-handling API

Duncan Coutts duncan.coutts at
Sat Jul 19 21:30:25 EDT 2008

On Sat, 2008-07-19 at 15:18 -0400, Brandon S. Allbery KF8NH wrote:
> On 2008 Jul 19, at 13:07, Duncan Coutts wrote:
> > In particular the case of "I need to do this cleanup before the  
> > program
> > terminates" is much more general than Posix and signals. For example a
> > library installing a handler for SIGINT is the wrong thing to do (and
> > not just because it's not very modular) but because the very decision
> > about whether SIGINT is going to kill the process or not is not for  
> > the
> > library to decide. What it needs is to be thrown an exception when the
> > process does decide that it's going to terminate.
> ...and here you see why I made my proposal about mapping signals to  
> exceptions.

Perhaps I misunderstood. I assumed you mean just a way of letting
programs map signals to exceptions, which is something they can do
already. What we'd need instead is to have all fatal signals be mapped
to exceptions and then let programs selectively block or remap them (eg
if command line progs want to use ^C for some alternative purpose).

That way library code can just use ordinary exception handlers to clean
up and would not have to think about signals at all.


More information about the Libraries mailing list