[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/c/program/signal [Back]  [Original]

signal cppreference.com
cppreference.com

signal

cppreference.com

<metanoindex/>

<tbody> </tbody>
<signal.h>
void (*signal( int sig, void (*handler) (int))) (int);
sig. , , , .
:
Sets the error handler for signal sig. The signal handler can be set so that default handling will occur, signal is ignored, or an user-defined function is called.
Google.
. .
, signal(sig, SIG_DFL) . , AF .
:
When signal handler is set to a function and a signal occurs, it is implementation defined whether signal(sig, SIG_DFL) will be executed immediately before the start of signal handler. Also, the implementation can prevent some implementation-defined set af signals from occurring while the signal handler runs.
Google.
. .
SIGFPE, SIGILL SIGSEGV, . .
:
If the user defined function returns when handling SIGFPE, SIGILL or SIGSEGV, the behavior is undefined. In most implementations the program terminates.
Google.
. .
abort raise, ,
:
If the signal handler is called as a result of abort or raise, the behavior is undefined if any of the following requirements is not followed:
Google.
. .
  • raise.
    :
    the signal handler calls raise.
    Google.
    . .
  • volatile sig_atomic_t.
    :
    the signal handler refers to an object of static storage duration which is not declared as volatile sig_atomic_t.
    Google.
    . .
  • , abort, _Exit, signal , .
    :
    the signal handler calls any function within the standard library, except abort, _Exit, or signal with the first argument not being the number of the signal currently handled.
    Google.
    . .

sig
, . :

() []
:
the signal to set the signal handler to. It can be an implementation-defined value or one of the following values:

() []
Google.
. .
handler
. : <tbody> </tbody>
void fun(int sig);
:
the signal handler. This must be one of the following:
  • SIG_DFL macro. The signal handler is set to default signal handler.
  • SIG_IGN macro. The signal is ignored.
  • pointer to a function. The signature of the function must be equivalent to the following:
<tbody> </tbody>
void fun(int sig);
Google.
. .

SIG_ERR ( ).
:
Previous signal handler on success or SIG_ERR on failure (setting a signal handler can be disabled on some implementations).
Google.
. .

.


() []
C++ signal

Web Proxy Viewer  |  New URL  |  Original Page