sigsetjmp()

Save the environment, including the signal mask

Synopsis:

#include <setjmp.h>

int sigsetjmp( sigjmp_buf env, 
               int savemask );

Arguments:

env
A buffer where the function can save the calling environment.
savemask
Nonzero if you want to save the process's current signal mask, otherwise 0.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The sigsetjmp() function behaves in the same way as the setjmp() function when savemask is zero. If savemask is nonzero, then sigsetjmp() also saves the thread's current signal mask as part of the calling environment.

DANGER
Don't use longjmp() or siglongjmp() to restore an environment saved by a call to setjmp() or sigsetjmp() in another thread. If you're lucky, your application will crash; if not, it'll look as if it works for a while, until random scribbling on the stack causes it to crash.

Returns:

Zero on the first call, or nonzero if the return is the result of a call to siglongjmp().

Examples:

See setjmp().

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes