siginterrupt() — Allow signals to interrupt functions

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single UNIX Specification, Version 3

both

POSIX(ON)

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <signal.h>

int siginterrupt(int sig, int flag);

General description

The siginterrupt() function provides a simplified method for changing the restart behavior when a function is interrupted by the signal specified in the argument sig.

The argument flag serves as a binary switch to enable or disable restart behavior. When flag is nonzero, restart behavior will be disabled. Otherwise it is enabled.

Returned value

If successful, siginterrupt() returns 0.

If unsuccessful, siginterrupt() returns -1 and sets errno to one of the following values:
Error Code
Description
EINVAL
The value of the argument sig is not a valid signal type.

Related information