signal_action


Use os_this_process::action() to take total control of how the current process reacts to a particular signal or set of signals. This function takes either a signal or a signal set as its first argument and an os_signal_action object as its second argument.

An os_signal_action specifies how a process reacts to signals. The default constructor creates a signal action that reacts to the signal in the default way. Another constructor creates a signal action that calls a used-supplied handler and takes the following parameters.

These flags perform the following actions.

Conversions permit os_signal_action and os_sigaction_t to be used interchangeably.

Library

Platform<ToolKit> for UNIX

Declaration

#include <ospace/unix/sigactn.h>

class os_signal_action

Typedefs

typedef struct sigaction os_sigaction_t;

Interface

Constructor
os_signal_action( const os_sigaction_t& action )
Constructs an object from action .
Constructor
os_signal_action( const os_signal_action& action )
Constructs an object that is a copy of action .
Constructor
os_signal_action()
Constructs an object that represents the default action.
Constructor
os_signal_action( void (*new_handler )( int ), const vector< os_sig_t >& signals , int flags )
Constructs an object with handler new_handler , blocked signal set signals (default empty set), and flags flags (default zero). If the object is installed for a signal using these default values, the object performs the following actions.
=
os_signal_action& operator=( const os_sigaction_t& action )
Assigns an object from action .
=
os_signal_action& operator=( const os_signal_action& action )
Assigns an object from action .
==
bool operator==( const os_signal_action& action ) const
Returns true if the object is the same as action .
(os_sigaction_t)
operator os_sigaction_t() const
Returns an object as a sigaction structure.
added_blocking
vector< os_sig_t > added_blocking() const
Returns the signal set that is added to the current process' blocked signals during handler execution.
added_blocking
void added_blocking( const vector< os_sig_t >& signals )
Sets the signal set that is added to the current process' blocked signals during execution of the signal handler to signals .

Throws: os_unix_toolkit_error

block_child_stop
void block_child_stop( bool flag )
If flag is true and this action is installed for SIGCHILD , a SIGCHILD signal is not generated when a child process terminates. If flag is false and this action is installed for SIGCHILD , a SIGCHILD signal is generated when a child process terminates.
block_child_stop
bool block_child_stop() const
Returns true if the object is set to block the delivery of SIGCHLD when a child process stops.
get_default
bool get_default() const
Returns true if the action is "perform default."
handle_once
void handle_once( bool flag )
If flag is true , resets the signal handler when the signal is delivered. This means that the handler only executes once, unless it is specifically reenabled. If flag is false, the handler remains installed and executes each time the signal is delivered.
handle_once
bool handle_once() const
Returns true if the object is set to handle only the first signal reception.
handler
void handler( void (*handler )( int ) )
Sets the action to "execute handler ."
ignore
bool ignore() const
Returns true if the action is "ignore."
print
void print( ostream& stream ) const
Prints to stream .
restart_system_calls
bool restart_system_calls() const
Returns true if the object is set to restart interrupted system calls.
restart_system_calls
void restart_system_calls( bool flag )
If flag is true , restarts an interrupted system call after the signal handler returns. If flag is false , the system call returns an error EINTR .
set_default
void set_default()
Sets the action to "perform default."
set_ignore
void set_ignore()
Sets the action to "ignore." Note that the kill and stop signals cannot be ignored.

Non-Member Functions

<<
ostream& operator<<( ostream& stream , const os_signal_action& action )
Prints action to stream .

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only. - For use by licensed users only.