siglongjmp()

QNX SDP8.0C Library ReferenceAPIDeveloper

Restore the environment saved by sigsetjmp(), including the signal mask

Synopsis:

#include <setjmp.h>

void siglongjmp( sigjmp_buf env, 
                 int val );

Arguments:

env
The environment saved by a previous call to sigsetjmp().
val
The value that you want sigsetjmp() to return.

Library:

libc

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

Description:

The siglongjmp() function restores the environment saved in the env argument by a previous call to sigsetjmp(). This environment includes the thread's signal mask.

Warning:
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.
CAUTION:
  • The following conditions result in undefined behavior:
    • The sigjmp_buf object passed to siglongjmp() was not populated by a previous call to sigsetjmp() made from the same thread.
    • The sigjmp_buf object represents an execution context that no longer exists (i.e., the block scope containing the sigsetjmp() call that populated the sigjmp_buf object has ended).
    • There was no previous invocation of sigsetjmp() to initialize the sigjmp_buf object.
  • QNX OS attempts to detect the cases listed below, and when it does, the OS outputs a diagnostic message and terminates the program abnormally via a SIGABRT signal:
    • The sigjmp_buf object was not populated by a call to setjmp() or sigsetjmp().
    • The sigjmp_buf was populated via setjmp() or sigsetjmp() but subsequently corrupted.

In the restored environment, all components (data types, status flags, and open files) have state and values, except for data objects with automatic storage duration. For these objects, their values are unspecified in some cases; for details, see the longjmp() reference.

Returns:

A call to siglongjmp() does not return. After this function restores the environment, program execution continues as if the corresponding call to sigsetjmp() had just returned the value specified by return_value. If return_value is 0, the value returned is 1.

Examples:

See longjmp().

Classification:

POSIX 1003.1

Safety:
Cancellation pointNo
Signal handlerYes
ThreadYes
Page updated: