20#ifndef WG14_SIGNALS_THREAD_LOCAL_SIGNAL_HANDLE_H
21#define WG14_SIGNALS_THREAD_LOCAL_SIGNAL_HANDLE_H
32#include <bits/types/siginfo_t.h>
43 typedef uint32_t sigset_t;
44 static inline void sigemptyset(sigset_t *ss)
48 static inline void sigfillset(sigset_t *ss)
52 static inline void sigaddset(sigset_t *ss,
const int signo)
54 *ss |= (1u << (signo - 1));
56 static inline void sigdelset(sigset_t *ss,
const int signo)
58 *ss &= ~(1u << (signo - 1));
60 static inline bool sigismember(
const sigset_t *ss,
const int signo)
62 return (*ss & (1u << (signo - 1))) != 0;
80 union WG14_SIGNALS_PREFIX(thrd_raised_signal_info_value)
84#if defined(__cplusplus)
109 typedef struct _EXCEPTION_RECORD
120 typedef struct _CONTEXT
123typedef struct ucontext_t
130 struct WG14_SIGNALS_PREFIX(thrd_raised_signal_info)
138 union WG14_SIGNALS_PREFIX(
148 typedef union WG14_SIGNALS_PREFIX(thrd_raised_signal_info_value)(
154 typedef union WG14_SIGNALS_PREFIX(thrd_raised_signal_info_value)(
178#pragma warning(disable : 4190)
268 union WG14_SIGNALS_PREFIX(thrd_raised_signal_info_value) value);
362 const sigset_t *guarded,
bool callfirst,
364 union WG14_SIGNALS_PREFIX(thrd_raised_signal_info_value) value);
#define WG14_SIGNALS_EXTERN
A platform independent subset of siginfo_t.
thrd_raised_signal_info_context_t * raw_context
The OS specific ucontext_t (POSIX) or PCONTEXT (Windows)
thrd_raised_signal_info_siginfo_t * raw_info
The OS specific signal info.
void * addr
Memory location which caused fault, if appropriate.
int signo
The signal raised.
thrd_raised_signal_error_code_t error_code
The system specific error code for this signal, the si_errno code (POSIX) or NTSTATUS code (Windows)
struct ucontext_t thrd_raised_signal_info_context_t
A placeholder type for an OS specific ucontext_t (POSIX) or PCONTEXT (Windows)
void * signal_decider_create(const sigset_t *guarded, bool callfirst, thrd_signal_decide_t decider, union thrd_raised_signal_info_value value)
THREADSAFE NOT REENTRANT Create a global signal continuation decider. Threadsafe with respect to othe...
const sigset_t * asynchronous_debug_sigset(void)
THREADSAFE ASYNC-SIGNAL-SAFE The set of debug asynchronous signals for this platform.
enum thrd_signal_decision_t() thrd_signal_decide_t(struct thrd_raised_signal_info *)
The type of the function called when a signal is raised. Returns a decision of how to handle the sign...
int threadsafe_signals_uninstall(void *i)
THREADSAFE Uninstall a previously installed signal guard.
thrd_signal_decision_t
The decision taken by the decider function.
@ thrd_signal_decision_invoke_recovery
Thread local signal deciders only: reset the stack and local state to entry to thrd_signal_invoke(),...
@ thrd_signal_decision_resume_execution
We have fixed the cause of the signal, please resume execution.
@ thrd_signal_decision_next_decider
We have decided to do nothing.
union thrd_raised_signal_info_value() thrd_signal_func_t(union thrd_raised_signal_info_value)
The type of the guarded function.
bool thrd_signal_raise(int signo, thrd_raised_signal_info_siginfo_t *raw_info, thrd_raised_signal_info_context_t *raw_context)
THREADSAFE USUALLY ASYNC-SIGNAL-SAFE Call OUR currently installed signal decider for a signal (POSIX)...
struct __siginfo thrd_raised_signal_info_siginfo_t
A placeholder type for an OS specific siginfo_t * (POSIX) or PEXCEPTION_RECORD (Windows)
const sigset_t * synchronous_sigset(void)
THREADSAFE ASYNC-SIGNAL-SAFE The set of synchronous signals for this platform.
union thrd_raised_signal_info_value thrd_signal_invoke(const sigset_t *signals, thrd_signal_func_t guarded, thrd_signal_recover_t recovery, thrd_signal_decide_t decider, union thrd_raised_signal_info_value value)
THREADSAFE USUALLY ASYNC-SIGNAL-SAFE Installs a thread-local signal guard for the calling thread,...
int signal_decider_destroy(void *decider)
THREADSAFE NOT REENTRANT Destroy a global signal continuation decider. Threadsafe with respect to oth...
int thrd_raised_signal_error_code_t
Typedef to a system specific error code type.
union thrd_raised_signal_info_value() thrd_signal_recover_t(const struct thrd_raised_signal_info *)
The type of the function called to recover from a signal being raised in a guarded section.
int threadsafe_signals_uninstall_system(int version)
THREADSAFE Uninstall a previously system installed signal guard.
const sigset_t * asynchronous_nondebug_sigset(void)
THREADSAFE ASYNC-SIGNAL-SAFE The set of non-debug asynchronous signals for this platform.
void * threadsafe_signals_install(const sigset_t *guarded, int version)
THREADSAFE Installs, and potentially enables, the global signal handlers for the signals specified by...