21
Language support library
[language.support]
21.10
Other runtime support
[support.runtime]
21.10.4
Signal handlers
[support.signal]
1
#
A call to the function
signal
synchronizes with any resulting invocation of the signal handler so installed
.
2
#
A
plain lock-free atomic operation
is an invocation of a function
f
from Clause
[atomics]
, such that:
(2.1)
f
is the function
atomic_is_lock_free()
, or
(2.2)
f
is the member function
is_lock_free()
, or
(2.3)
f
is a non-static member function invoked on an object
A
, such that
A.is_lock_free()
yields
true
, or
(2.4)
f
is a non-member function, and for every pointer-to-atomic argument
A
passed to
f
,
atomic_is_lock_free(A)
yields
true
.
3
#
An evaluation is
signal-safe
unless it includes one of the following:
(3.1)
a call to any standard library function, except for plain lock-free atomic operations and functions explicitly identified as signal-safe
.
[
Note
:
This implicitly excludes the use of
new
and
delete
expressions that rely on a library-provided memory allocator
.
—
end note
]
(3.2)
an access to an object with thread storage duration;
(3.3)
a
dynamic_cast
expression;
(3.4)
throwing of an exception;
(3.5)
control entering a
try-block
or
function-try-block
;
(3.6)
initialization of a variable with static storage duration requiring dynamic initialization (
[basic.start.dynamic]
,
[stmt.dcl]
)
220
; or
(3.7)
waiting for the completion of the initialization of a variable with static storage duration (
[stmt.dcl]
)
.
A signal handler invocation has undefined behavior if it includes an evaluation that is not signal-safe
.
4
#
The function
signal
is signal-safe if it is invoked with the first argument equal to the signal number corresponding to the signal that caused the invocation of the handler
.
See also:
ISO C 7
.
14
.
220)
Such initialization might occur because it is the first odr-use (
[basic.def.odr]
) of that variable
.