# The "s" Package

These routines are meant to provide a simplified interface to the Unix signal management routines. These routines allow blocking and unblocking of signals without the dangers of deadlock (common on multi-threaded machines). A few "standard" signal handlers are also provided.

Library: karma
Link With: -lkarma

#### Functions

s_block | Block a signal.
s_unblock | Unblock a signal.
s_unblock_all | Unblock all signals.
s_ignore | Cause a signal to be ignored.
s_int_handler | Recommended SIGINT handler.
s_term_handler | Recommended SIGTERM handler.
s_check_for_int | Check for queued SIGINTs.
s_install_handlers | Install recommended signal handlers for SIGINT and SIGTERM.

## Functions

void s_block (int signal)

This routine will cause a signal to be blocked until a subsequent call to s_unblock or s_unblock_all. If the signal is already blocked, no action is taken.

Parameters:

- signal : The signal to block.

Returns: Nothing.
Multithreading Level: Unsafe

void s_unblock (int signal)

This routine will cause a signal to be unblocked. If the signal is not already blocked, no action is taken.

Parameters:

- signal : The signal to unblock.

Returns: Nothing.
Multithreading Level: Unsafe
Note:

- The signal will only be unblocked if previously blocked by a call to s_block.

void s_unblock_all ()

This routine will cause all signals blocked by s_block to be unblocked. If no signals were blocked, no action is taken.

Parameters:

This function takes no parameters

Returns: Nothing.
Multithreading Level: Unsafe

void * s_ignore (int sig)

Cause a signal to be ignored.

Parameters:

- sig : The signal to ignore.

Returns: The previous signal handler.
Multithreading Level: Unsafe

void s_int_handler ()

This routine will handle SIGINT signals (those generated by the C shell in response to a control C keypress).

Parameters:

This function takes no parameters

Returns: Nothing.
Multithreading Level: Unsafe

void s_term_handler ()

This routine will handle SIGTERM signals.

Parameters:

This function takes no parameters

Returns: Nothing.
Multithreading Level: Unsafe

flag s_check_for_int ()

This routine will check if there is a queued interrupt (SIGINT) pending. A single pending interrupt is removed from the queue.

Parameters:

This function takes no parameters

Returns: TRUE if there is a queued SIGINT, else FALSE.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag s_install_handlers ()

Install recommended signal handlers for SIGINT and SIGTERM.

Parameters:

This function takes no parameters

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe

Back to Karma Home Page