oop_sys_run(), oop_sys_run_once()

#include <oop.h>

/* Run the event loop. */
oop_source *oop_sys_run(oop_source_sys *sys);
oop_source *oop_sys_run_once(oop_source_sys *sys);

Arguments.

oop_source_sys *sys
The event source to operate.

Description.

The oop_sys_run() function starts waiting for events registered with the system event source sys. As events (file descriptor activity, timed events, and signals) occur, the appropriate event sinks are called. As long as these callbacks return OOP_CONTINUE, the function continues running and processing events.

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 "owner" of the event loop (the caller of oop_sys_run). You may then decide whether to restart the event loop (by calling oop_sys_run again) or not.

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), oop_sys_run returns OOP_CONTINUE.

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.


liboop reference