Signal handling integration with glib main loop
[ICd internal functions]


Typedefs

typedef void(* icd_signal_handler_fn )(int sig)

Functions

static void icd_signal_handler (int sig)
static gboolean icd_signal_cb (GIOChannel *chan, GIOCondition cond, gpointer data)
int icd_signal_init (icd_signal_handler_fn signal_handler,...)

Variables

static int signal_pipe [2]

Typedef Documentation

typedef void(* icd_signal_handler_fn)(int sig)

The signal handler function

Parameters:
sig the received signal


Function Documentation

static gboolean icd_signal_cb ( GIOChannel *  chan,
GIOCondition  cond,
gpointer  data 
) [static]

GLib callback called from main loop when the signal pipe receives data. This function only polls the signal pipe and calls signal_handler to do the actual work.

Parameters:
chan IO Channel associated with file descriptor.
cond Condition which triggered callback.
data the signal handler function to call

Referenced by icd_signal_init().

static void icd_signal_handler ( int  sig  )  [static]

Signal handler.

Parameters:
sig Received signal number.
Note:
Only queues received signals on pipe which is polled by main thread. Thus signals are handler synchronously on specific point.

References signal_pipe.

Referenced by icd_signal_init().

int icd_signal_init ( icd_signal_handler_fn  signal_handler,
  ... 
)

Initialize signal handling. Create pipe for queueing signals from signal handler to main thread. Hook all processed signals and create a Glib io watch for the pipe.

Parameters:
signal_handler function handling the signal
... signals to watch, end with -1

References icd_signal_cb(), icd_signal_handler(), ILOG_ERR, and signal_pipe.

Referenced by main().


Variable Documentation

int signal_pipe[2] [static]

pipe used in communication between the posix signal handler and the glib main loop

Referenced by icd_signal_handler(), and icd_signal_init().


Generated on Thu Mar 11 09:04:50 2010 for ICd2 by  doxygen 1.5.6