Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>liboop: on_signal(), cancel_signal()</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head><body>

<h2>on_signal(), cancel_signal()</h2>

<pre>
#include &lt;oop.h&gt;
#include &lt;signal.h&gt;

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

/* <em>Register and unregister UNIX signal event sinks.</em> */
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);
</pre>

<h3>Arguments.</h3>

<dl>
<dt><b>oop_source *source</b>
<dd>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-&gt;on_signal(src,...);".<p>

<dt><b>int sig</b>
<dd>The UNIX signal to monitor (SIGINT, SIGHUP, etc.).<p>

<dt><b>oop_call_signal *call</b>
<dd>The callback function (event sink) to add (or remove).<p>

<dt><b>void *user</b>
<dd>User data passed through to the callback function.<p>
</dl>

<h3>Description.</h3>

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

<dl>
<dt><b>on_signal</b>
<dd>After this function is called, if the signal <em>sig</em> is received,
when the event loop next runs (immediately, if it is currently waiting for
events), the event source will call the function <em>call</em>, passing it a
pointer to the event source, the signal received, and the same opaque
<em>user</em> 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.<p>

<dt><b>cancel_signal</b>
<dd>Deactivate an event sink callback registered using on_signal (above).  If
the passed <em>sig</em>, <em>call</em> and <em>user</em> 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.<p>

<dt><b>oop_call_fd</b>
<dd>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.
</dl>

<hr><a href="ref">liboop reference</a></body></html>