Alastair Reid <[EMAIL PROTECTED]> writes:

> > >  Windows {3.1,95,NT} are three such platforms and
> > > Linux is perhaps another.  The question is:
> > > 
> > >   Is it safe to longjmp out of a signal handler?
> > 
> > Under Linux, it is.
> 
> The POSIX standard does not guarantee that it is safe.
> 
> AFAIK, Linux documentation does not say one way or the other.

Depends on what you mean by "safe".  I don't think it's really safe on
any UNIX platform, because you can leave malloc() and other libraries
in an inconsistent state.  But you surely know that; so I'm guessing
you're talking about only the issue of signal masking.

> What I was describing was the masking of signals that is done
> automatically when entering a signal handler and undone when exiting.
> If you never exit the handler (ie you longjmp out of the handler),
> the signal will never be reenabled.

That's why you use the POSIX functions sigsetjmp/siglongjmp.  These
act like setjmp/longjmp except that they save and restore the set of
blocked signals.

Carl Witty
[EMAIL PROTECTED]

Reply via email to