Skip to content
Snippets Groups Projects
Commit aed58001 authored by Dan Egnor's avatar Dan Egnor
Browse files

Add oop_sys_run_once()

parent 61924a99
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,8 @@ void oop_sys_delete(oop_source_sys *sys); ...@@ -29,7 +29,8 @@ void oop_sys_delete(oop_source_sys *sys);
event source interface and manages a select() loop. Once the system event event source interface and manages a select() loop. Once the system event
source is created, use <a href="oop_sys_source">oop_sys_source()</a> to source is created, use <a href="oop_sys_source">oop_sys_source()</a> to
access the event source interface (which lets you register event sinks), and access the event source interface (which lets you register event sinks), and
<a href="oop_sys_run">oop_sys_run()</a> to actually process events. <a href="oop_sys_run">oop_sys_run()</a> or
<a href="oop_sys_run">oop_sys_run_once()</a> to actually process events.
More than one system event source can exist, though it is rarely useful to do More than one system event source can exist, though it is rarely useful to do
so (since only one may be active at a time).<p> so (since only one may be active at a time).<p>
......
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head><body> </head><body>
<h2>oop_sys_run()</h2> <h2>oop_sys_run(), oop_sys_run_once()</h2>
<pre> <pre>
#include &lt;oop.h&gt; #include &lt;oop.h&gt;
/* <em>Run the event loop.</em> */ /* <em>Run the event loop.</em> */
oop_source *oop_sys_run(oop_source_sys *sys); oop_source *oop_sys_run(oop_source_sys *sys);
oop_source *oop_sys_run_once(oop_source_sys *sys);
</pre> </pre>
<h3>Arguments.</h3> <h3>Arguments.</h3>
...@@ -21,11 +22,11 @@ oop_source *oop_sys_run(oop_source_sys *sys); ...@@ -21,11 +22,11 @@ oop_source *oop_sys_run(oop_source_sys *sys);
<h3>Description.</h3> <h3>Description.</h3>
This function starts waiting for events registered with the system event The oop_sys_run() function starts waiting for events registered with the
source <em>sys</em>. As events (file descriptor activity, timed events, and system event source <em>sys</em>. As events (file descriptor activity, timed
signals) occur, the appropriate event sinks are called. As long as these events, and signals) occur, the appropriate event sinks are called. As long
callbacks return OOP_CONTINUE, the function continues running and processing as these callbacks return OOP_CONTINUE, the function continues running and
events.<p> processing events.<p>
When one of the callbacks returns some other value, oop_sys_run returns this When one of the callbacks returns some other value, oop_sys_run returns this
value. You can use this technique to allow callbacks to return data to the value. You can use this technique to allow callbacks to return data to the
...@@ -36,4 +37,9 @@ If an error occurs waiting for events, oop_sys_run returns OOP_ERROR. ...@@ -36,4 +37,9 @@ If an error occurs waiting for events, oop_sys_run returns OOP_ERROR.
If no event sinks are registered (which would lead to an infinite delay), If no event sinks are registered (which would lead to an infinite delay),
oop_sys_run returns OOP_CONTINUE.<p> oop_sys_run returns OOP_CONTINUE.<p>
The oop_sys_run_once() function behaves just like oop_sys_run(), but returns
immediately after processing any pending results. The return values are the
same as oop_sys_run(), except that a return of OOP_CONTINUE does not
necessarily mean that no event sinks are registered.<p>
<hr><a href="ref">liboop reference</a></body></html> <hr><a href="ref">liboop reference</a></body></html>
...@@ -43,6 +43,7 @@ void <a href="oop_sys">oop_sys_delete</a>(oop_source_sys *); ...@@ -43,6 +43,7 @@ void <a href="oop_sys">oop_sys_delete</a>(oop_source_sys *);
/* <em>Run the system event loop.</em> */ /* <em>Run the system event loop.</em> */
void *<a href="oop_sys_run">oop_sys_run</a>(oop_source_sys *); void *<a href="oop_sys_run">oop_sys_run</a>(oop_source_sys *);
void *<a href="oop_sys_run">oop_sys_run_once</a>(oop_source_sys *);
/* <em>Get the standard source interface for a system event source.</em> */ /* <em>Get the standard source interface for a system event source.</em> */
oop_source *<a href="oop_sys_source">oop_sys_source</a>(oop_source_sys *); oop_source *<a href="oop_sys_source">oop_sys_source</a>(oop_source_sys *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment