This class is a sort of wrap-around the sigaction call to set a handler on a given signal. More...
#include <IOhandler.h>
Public Member Functions | |
IOhandler (int s) | |
Constructor. | |
~IOhandler () | |
Destructor. | |
void | Register (void(*f)(void *), void *p) |
Registers to a IOhandler. | |
void | Unregister () |
Unregister. | |
void | ResetTrg () |
resets the interrupt handler | |
void | PrepareForData () |
Prepares to catch interrupts. | |
double | GetNtrg () |
returns the number of interrupts | |
bool | Data () |
returns true if a new interrupt has arrived | |
void | WaitForData () |
waits for an interrupt | |
Static Public Member Functions | |
static void | gotIO (int) |
actial signal catcher | |
Private Member Functions | |
int | lock () |
lock | |
bool | trylock () |
check if it is locked | |
int | unlock () |
unlock | |
Private Attributes | |
int | signum |
Specifies the signal to catch. | |
double | nTrg |
number of signal interrupts | |
bool | newData |
set to true when an interrupt occurs | |
int | sem |
semaphore | |
struct sigaction | actIO |
internal sigaction structure | |
void(* | func )(void *) |
callback function | |
void * | ptr |
pointer | |
Static Private Attributes | |
static IOhandler * | instance = 0 |
instance |
This class is a sort of wrap-around the sigaction call to set a handler on a given signal.
One example of use is to register to the SIGIO signal to detect when there is data available