Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Signal event handling.


Detailed Description

The event library provides support for signal handling. The library will block all signals, then generate an event for the generated signal. Use this interface in preference to standard C signal handlers.


Files

file  sig.h
 Signal event system header file.

Data Structures

struct  _ev_sig_s
 Signal generator structure. More...

Defines

#define EV_SIG_MAGIC
 Signal generator magic number.
#define si_verify(sig)
 Signal generator verification macro.
#define si_signal(sig)
 Signal number.

Typedefs

typedef _ev_sig_s ev_sig_t
 Signal generator.

Functions

ev_err_t signal_create (ev_ctx_t *ctx, int signal, ev_call_t call, void *data, ev_sig_t **sig_p)
 Create a signal.
ev_err_t signal_destroy (ev_ctx_t *ctx, ev_sig_t *sig)
 Destroy an existing signal.


Define Documentation

#define EV_SIG_MAGIC
 

This is the magic number used for the signal generator structure.

Definition at line 70 of file sig.h.

Referenced by event_init(), and main().

#define si_signal sig   ) 
 

This macro returns the number of the signal handled by the signal generator.

Parameters:
[in] sig A pointer to an ev_sig_t.
Returns:
An integer containing the handled signal number.

Definition at line 95 of file sig.h.

#define si_verify sig   ) 
 

This macro verifies that a given pointer actually does point to an ev_sig_t.

Warning:
This macro evaluates the sig argument twice.
Parameters:
[in] sig A pointer to an ev_sig_t.
Returns:
Boolean true if sig is a valid signal generator or false otherwise.

Definition at line 84 of file sig.h.

Referenced by signal_destroy().


Typedef Documentation

typedef struct _ev_sig_s ev_sig_t
 

Signals are described using this structure.

Definition at line 53 of file sig.h.


Function Documentation

ev_err_t signal_create ev_ctx_t ctx,
int  signal,
ev_call_t  call,
void *  data,
ev_sig_t **  sig_p
 

This function creates a generator for the specified signal. If the sig_p parameter is not NULL, it will be used to return a pointer to the created signal generator.

Test:
This function is tested in t_signal_fcns.c.
Parameters:
[in] ctx A pointer to an ev_ctx_t.
[in] signal One of the signal constants defined in signal.h.
[in] call The callback function for the library to use. If NULL, the library may not be used in the event loop mode.
[in] data Any application-specific data that must be passed to the callback function.
[out] sig_p A pointer to a pointer to an ev_sig_t. A NULL value may be passed if the application does not need a pointer to the signal generator.
Return values:
EINVAL An invalid argument was given.
ENOMEM Out of memory.

Definition at line 34 of file signal_create.c.

References _ev_ctx_s::ec_signal, ec_verify, eg_callback_set, eg_calldata_set, eg_ref_inc, EGT_SIGNAL, _ev_englist_s::el_first, _ev_englink_s::el_next, _ev_englink_s::el_prev, eng_sig_add, eng_sig_rem, _ev_engine_s::eng_signal, _ev_signals_s::esi_active, ev_init, ev_return, event_gen_alloc(), event_gen_release(), _ev_sig_s::si_oact, and _ev_sig_s::si_signal.

Referenced by main().

Here is the call graph for this function:

ev_err_t signal_destroy ev_ctx_t ctx,
ev_sig_t sig
 

This function is used to destroy an existing signal generator.

Test:
This function is tested in t_signal_fcns.c.
Parameters:
[in] ctx A pointer to an ev_ctx_t.
[in] sig A pointer to the ev_sig_t to be destroyed.
Return values:
EINVAL An invalid argument was given.

Definition at line 32 of file signal_destroy.c.

References _ev_ctx_s::ec_signal, ec_verify, eg_context, eg_flags, eg_flags_set, eg_ref_dec, _ev_englist_s::el_last, _ev_englink_s::el_prev, eng_sig_rem, _ev_engine_s::eng_signal, _ev_signals_s::esi_active, EV_GEN_DELETED, ev_init, ev_return, and si_verify.

Referenced by main().


Generated on Wed Dec 28 23:38:07 2005 for event by  doxygen 1.4.4