## on_signal(), cancel_signal()

    #include <oop.h>
    #include <signal.h>

    /* Callback function prototype. */
    typedef void *oop_call_signal(oop_source *source,int sig,void *user);

    /* Register and unregister UNIX signal event sinks. */
    void (*on_signal)(oop_source *source,int sig,oop_call_signal *call,void *user);
    void (*cancel_signal)(oop_source *source,int sig,oop_call_signal *call,void *user);

### Arguments.

oop_source *source
  The event source to register or unregister the event sink with. This must be the same event source you got the function pointer from: "src->on_signal(src,...);".

int sig
  The UNIX signal to monitor (SIGINT, SIGHUP, etc.).

oop_call_signal *call
  The callback function (event sink) to add (or remove).

void *user
  User data passed through to the callback function.

### Description.

Note that these are not global functions, but function pointers supplied by the event source (in the oop_source structure) or by the user.

on_signal
  After this function is called, if the signal sig is received, when the event loop next runs (immediately, if it is currently waiting for events), the event source will call the function call, passing it a pointer to the event source, the signal received, and the same opaque user pointer passed to on_signal. This callback will be called again if the signal occurs again, but if the signal is received multiple times in quick succession the event sink may only receive a single callback. Many callbacks may be registered for the same signal.

cancel_signal
  Deactivate an event sink callback registered using on_signal (above). If the passed sig, call and user match a previously registered callback, it will be removed; if they match more than one, one of them will be removed; otherwise, no action is taken.

oop_call_fd
  Called when the event is triggered. Performs a user_specific action. Should return OOP_CONTINUE if the event loop should continue operating; any other value (including OOP_HALT) will cause termination of the event loop.

liboop reference