| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html><head> |
| 3 |
<title>liboop: oop_sys_run()</title> |
| 4 |
<link rel="stylesheet" type="text/css" href="style.css"> |
| 5 |
</head><body> |
| 6 |
|
| 7 |
<h2>oop_sys_run(), oop_sys_run_once()</h2> |
| 8 |
|
| 9 |
<pre> |
| 10 |
#include <oop.h> |
| 11 |
|
| 12 |
/* <em>Run the event loop.</em> */ |
| 13 |
oop_source *oop_sys_run(oop_source_sys *sys); |
| 14 |
oop_source *oop_sys_run_once(oop_source_sys *sys); |
| 15 |
</pre> |
| 16 |
|
| 17 |
<h3>Arguments.</h3> |
| 18 |
<dl> |
| 19 |
<dt><b>oop_source_sys *sys</b> |
| 20 |
<dd>The event source to operate. |
| 21 |
</dl> |
| 22 |
|
| 23 |
<h3>Description.</h3> |
| 24 |
|
| 25 |
The oop_sys_run() function starts waiting for events registered with the |
| 26 |
system event source <em>sys</em>. As events (file descriptor activity, timed |
| 27 |
events, and signals) occur, the appropriate event sinks are called. As long |
| 28 |
as these callbacks return OOP_CONTINUE, the function continues running and |
| 29 |
processing events.<p> |
| 30 |
|
| 31 |
When one of the callbacks returns some other value, oop_sys_run returns this |
| 32 |
value. You can use this technique to allow callbacks to return data to the |
| 33 |
"owner" of the event loop (the caller of oop_sys_run). You may then decide |
| 34 |
whether to restart the event loop (by calling oop_sys_run again) or not.<p> |
| 35 |
|
| 36 |
If an error occurs waiting for events, oop_sys_run returns OOP_ERROR. |
| 37 |
If no event sinks are registered (which would lead to an infinite delay), |
| 38 |
oop_sys_run returns OOP_CONTINUE.<p> |
| 39 |
|
| 40 |
The oop_sys_run_once() function behaves just like oop_sys_run(), but returns |
| 41 |
immediately after processing any pending results. The return values are the |
| 42 |
same as oop_sys_run(), except that a return of OOP_CONTINUE does not |
| 43 |
necessarily mean that no event sinks are registered.<p> |
| 44 |
|
| 45 |
<hr><a href="ref.html">liboop reference</a></body></html> |