|
725 | 725 |
|
726 | 726 | \rSec3[numeric.limits.members]{\tcode{numeric_limits} members}
|
727 | 727 |
|
| 728 | +\pnum |
| 729 | +\indextext{signal-safe!\idxcode{numeric_limits} members}% |
| 730 | +Each member function defined in this subclause is signal-safe~(\ref{csignal.syn}). |
| 731 | + |
728 | 732 | \indexlibrarymember{min}{numeric_limits}%
|
729 | 733 | \begin{itemdecl}
|
730 | 734 | static constexpr T min() noexcept;
|
|
1620 | 1624 | The program is terminated without executing destructors for objects of automatic,
|
1621 | 1625 | thread, or static storage duration and without calling functions passed to
|
1622 | 1626 | \tcode{atexit()}~(\ref{basic.start.term}).
|
| 1627 | +\indextext{signal-safe!\idxcode{_Exit}}% |
| 1628 | +The function \tcode{_Exit} is signal-safe~(\ref{csignal.syn}). |
1623 | 1629 | \end{itemdescr}
|
1624 | 1630 |
|
1625 | 1631 | \indexlibrary{\idxcode{abort}}%
|
|
1638 | 1644 | automatic, thread, or static storage
|
1639 | 1645 | duration and without calling functions passed to
|
1640 | 1646 | \tcode{atexit()}~(\ref{basic.start.term}).
|
1641 |
| -% |
1642 |
| -\indexlibrary{\idxcode{atexit}}% |
| 1647 | +\indextext{signal-safe!\idxcode{abort}}% |
| 1648 | +The function \tcode{abort} is signal-safe~(\ref{csignal.syn}). |
1643 | 1649 | \end{itemdescr}
|
1644 | 1650 |
|
1645 | 1651 | \indexlibrary{\idxcode{atexit}}%
|
|
1788 | 1794 | The standard file buffers are not flushed.
|
1789 | 1795 | \end{note}
|
1790 | 1796 |
|
| 1797 | +\pnum |
| 1798 | +\remarks |
| 1799 | +\indextext{signal-safe!\idxcode{quick_exit}}% |
| 1800 | +The function \tcode{quick_exit} is signal-safe~(\ref{csignal.syn}) |
| 1801 | +when the functions registered with \tcode{at_quick_exit} are. |
1791 | 1802 | \end{itemdescr}
|
1792 | 1803 |
|
1793 | 1804 | \xref~\ref{basic.start}, \ref{basic.start.term},
|
|
3578 | 3589 | \pnum
|
3579 | 3590 | The header \tcode{<initializer_list>} defines a class template and several
|
3580 | 3591 | support functions related to list-initialization~(see \ref{dcl.init.list}).
|
| 3592 | +\indextext{signal-safe!\idxcode{initializer_list} functions}% |
| 3593 | +All functions specified in this subclause are signal-safe~(\ref{csignal.syn}). |
3581 | 3594 |
|
3582 | 3595 | \rSec2[initializer_list.syn]{Header \tcode{<initializer_list>} synopsis}
|
3583 | 3596 | \indexlibrary{\idxcode{initializer_list}}%
|
|
3889 | 3902 | namespace std {
|
3890 | 3903 | using sig_atomic_t = @\seebelow@;
|
3891 | 3904 |
|
| 3905 | + // \ref{support.signal}, signal handlers |
3892 | 3906 | extern "C" using @\placeholdernc{signal-handler}@ = void(int); // \expos
|
3893 | 3907 | @\placeholder{signal-handler}@* signal(int sig, @\placeholder{signal-handler}@* func);
|
3894 | 3908 |
|
|
3912 | 3926 | The contents of the header \tcode{<csignal>} are the same as the C
|
3913 | 3927 | standard library header \tcode{<signal.h>}.
|
3914 | 3928 |
|
| 3929 | +\rSec2[support.signal]{Signal handlers} |
| 3930 | + |
3915 | 3931 | \pnum
|
3916 | 3932 | A call to the function \tcode{signal} synchronizes with any resulting
|
3917 | 3933 | invocation of the signal handler so installed.
|
3918 | 3934 |
|
3919 | 3935 | \pnum
|
3920 |
| -The common subset of the C and \Cpp languages consists of all declarations, |
3921 |
| -definitions, and expressions that may appear in a well formed \Cpp program |
3922 |
| -and also in a conforming C program. |
3923 |
| -A |
3924 |
| -\indextext{POF}% |
3925 |
| -\indextext{function!plain old}% |
3926 |
| -POF (``plain old function'') is a function that uses only features from |
3927 |
| -this common subset, and that does not directly or indirectly use any |
3928 |
| -function that is not a POF, except that it may use |
3929 |
| -plain lock-free atomic operations. |
3930 |
| -A \term{plain lock-free atomic operation} is an invocation of a function |
3931 |
| -\placeholder{f} from Clause~\ref{atomics}, such that \placeholder{f} is not a |
3932 |
| -member function, and either \placeholder{f} is the function |
3933 |
| -\tcode{atomic_is_lock_free}, or for every atomic argument \tcode{A} passed to |
3934 |
| -\placeholder{f}, \tcode{atomic_is_lock_free(A)} yields \tcode{true}. |
3935 |
| -All signal handlers shall have C linkage. |
3936 |
| -The behavior of any function other than a POF used as a signal handler in a |
3937 |
| -\Cpp program is \impldef{use of non-POF function as signal handler}.\footnote{In |
3938 |
| -particular, a signal handler using exception handling is very likely to |
3939 |
| -have problems. Also, invoking \tcode{std::exit} may cause destruction of objects, |
3940 |
| -including those of the standard library implementation, which, in general, yields |
3941 |
| -undefined behavior in a signal handler (see~\ref{intro.execution}).} |
| 3936 | +A \defn{plain lock-free atomic operation} is |
| 3937 | +an invocation of a function \tcode{f} from Clause~\ref{atomics}, |
| 3938 | +such that: |
| 3939 | + |
| 3940 | +\begin{itemize} |
| 3941 | +\item |
| 3942 | +\tcode{f} is the function \tcode{atomic_is_lock_free()}, or |
| 3943 | + |
| 3944 | +\item |
| 3945 | +\tcode{f} is the member function \tcode{is_lock_free()}, or |
| 3946 | + |
| 3947 | +\item |
| 3948 | +\tcode{f} is a non-static member function invoked on an object \tcode{A}, |
| 3949 | +such that \tcode{A.is_lock_free()} yields \tcode{true}, or |
| 3950 | + |
| 3951 | +\item |
| 3952 | +\tcode{f} is a non-member function, and |
| 3953 | +for every pointer-to-atomic argument \tcode{A} passed to \tcode{f}, |
| 3954 | +\tcode{atomic_is_lock_free(A)} yields \tcode{true}. |
| 3955 | +\end{itemize} |
| 3956 | + |
| 3957 | +\pnum |
| 3958 | +\indextext{signal-safe!evaluation|see{evaluation, signal-safe}}% |
| 3959 | +An evaluation is \defnx{signal-safe}{evaluation!signal-safe} unless it includes one of the following: |
| 3960 | + |
| 3961 | +\begin{itemize} |
| 3962 | +\item |
| 3963 | +a call to any standard library function, |
| 3964 | +except for plain lock-free atomic operations and |
| 3965 | +functions explicitly identified as signal-safe. |
| 3966 | +\begin{note} |
| 3967 | +This implicitly excludes the use of \tcode{new} and \tcode{delete} expressions |
| 3968 | +that rely on a library-provided memory allocator. |
| 3969 | +\end{note} |
| 3970 | + |
| 3971 | +\item |
| 3972 | +an access to an object with thread storage duration; |
| 3973 | + |
| 3974 | +\item |
| 3975 | +a \tcode{dynamic_cast} expression; |
| 3976 | + |
| 3977 | +\item |
| 3978 | +throwing of an exception; |
| 3979 | + |
| 3980 | +\item |
| 3981 | +control entering a \grammarterm{try-block} or \grammarterm{function-try-block}; |
| 3982 | + |
| 3983 | +\item |
| 3984 | +initialization of a variable with static storage duration |
| 3985 | +requiring dynamic initialization~(\ref{basic.start.dynamic}, \ref{stmt.dcl})% |
| 3986 | +\footnote{Such initialization might occur because it is the first odr-use~(\ref{basic.def.odr}) of that variable.}; or |
| 3987 | + |
| 3988 | +\item |
| 3989 | +waiting for the completion of the initialization of a variable with static storage duration~(\ref{stmt.dcl}). |
| 3990 | +\end{itemize} |
| 3991 | + |
| 3992 | +A signal handler invocation has undefined behavior if it includes |
| 3993 | +an evaluation that is not signal-safe. |
| 3994 | + |
| 3995 | +\pnum |
| 3996 | +\indextext{signal-safe!\idxcode{signal}}% |
| 3997 | +The function \tcode{signal} is signal-safe if it is invoked |
| 3998 | +with the first argument equal to the signal number |
| 3999 | +corresponding to the signal that caused the invocation of the handler. |
3942 | 4000 |
|
3943 | 4001 | \xref ISO C~7.14.
|
0 commit comments