![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
Abstracted event loopAbstracted event loop — Abstracted event loop API for customizing event loop in GCutter. |
#define GCUT_EVENT_LOOP_ERROR struct GCutEventLoop; struct GCutEventLoopClass; guint gcut_event_loop_add_idle (GCutEventLoop *loop
,GSourceFunc function
,gpointer data
); guint gcut_event_loop_add_idle_full (GCutEventLoop *loop
,gint priority
,GSourceFunc function
,gpointer data
,GDestroyNotify notify
); guint gcut_event_loop_add_timeout (GCutEventLoop *loop
,gdouble interval_in_seconds
,GSourceFunc function
,gpointer data
); guint gcut_event_loop_add_timeout_full (GCutEventLoop *loop
,gint priority
,gdouble interval_in_seconds
,GSourceFunc function
,gpointer data
,GDestroyNotify notify
); GQuark gcut_event_loop_error_quark (void
); gboolean gcut_event_loop_iterate (GCutEventLoop *loop
,gboolean may_block
); void gcut_event_loop_quit (GCutEventLoop *loop
); gboolean gcut_event_loop_remove (GCutEventLoop *loop
,guint tag
); void gcut_event_loop_run (GCutEventLoop *loop
); guint gcut_event_loop_watch_child (GCutEventLoop *loop
,GPid pid
,GChildWatchFunc function
,gpointer data
); guint gcut_event_loop_watch_child_full (GCutEventLoop *loop
,gint priority
,GPid pid
,GChildWatchFunc function
,gpointer data
,GDestroyNotify notify
); guint gcut_event_loop_watch_io (GCutEventLoop *loop
,GIOChannel *channel
,GIOCondition condition
,GIOFunc function
,gpointer data
);
GCutEventLoop encapsulates event loop. For example, event loop is used in GCutProcess. It uses the GLib's default main context for it.
Normally, a custom GCutEventLoop isn't required. It is needed some special case. For example, using libev as event loop backend instead of GLib's main loop.
GCutter provides GCutEventLoop for GLib's main context and main loop, GCutGLibEventLoop.
struct GCutEventLoopClass { GObjectClass parent_class; void (*run) (GCutEventLoop *loop); gboolean (*iterate) (GCutEventLoop *loop, gboolean may_block); void (*quit) (GCutEventLoop *loop); guint (*watch_io) (GCutEventLoop *loop, GIOChannel *channel, GIOCondition condition, GIOFunc function, gpointer data); guint (*watch_child_full) (GCutEventLoop *loop, gint priority, GPid pid, GChildWatchFunc function, gpointer data, GDestroyNotify notify); guint (*add_timeout_full) (GCutEventLoop *loop, gint priority, gdouble interval_in_seconds, GSourceFunc function, gpointer data, GDestroyNotify notify); guint (*add_idle_full) (GCutEventLoop *loop, gint priority, GSourceFunc function, gpointer data, GDestroyNotify notify); gboolean (*remove) (GCutEventLoop *loop, guint tag); };
guint gcut_event_loop_add_idle (GCutEventLoop *loop
,GSourceFunc function
,gpointer data
);
Adds the function
to be called whenever there are no
higher priority events pending with the default priority.
|
a GCutEventLoop. |
|
function to call |
|
data to pass to function
|
Returns : |
the event ID. |
Since 1.1.6
guint gcut_event_loop_add_idle_full (GCutEventLoop *loop
,gint priority
,GSourceFunc function
,gpointer data
,GDestroyNotify notify
);
Adds the function
to be called whenever there are no
higher priority events pending with the priority
.
|
a GCutEventLoop. |
|
the priority of the event. |
|
function to call |
|
data to pass to function
|
|
function to call when the event is removed, or NULL
|
Returns : |
the event ID. |
Since 1.1.6
guint gcut_event_loop_add_timeout (GCutEventLoop *loop
,gdouble interval_in_seconds
,GSourceFunc function
,gpointer data
);
Adds the function
to be called at regular intervals,
with the default priority.
|
a GCutEventLoop. |
|
the time between calls to the function , in seconds. |
|
function to call |
|
data to pass to function
|
Returns : |
the event ID. |
Since 1.1.6
guint gcut_event_loop_add_timeout_full (GCutEventLoop *loop
,gint priority
,gdouble interval_in_seconds
,GSourceFunc function
,gpointer data
,GDestroyNotify notify
);
Adds the function
to be called at regular intervals,
with the priority
.
|
a GCutEventLoop. |
|
the priority of the event. |
|
the time between calls to the function , in seconds. |
|
function to call |
|
data to pass to function
|
|
function to call when the event is removed, or NULL
|
Returns : |
the event ID. |
Since 1.1.6
gboolean gcut_event_loop_iterate (GCutEventLoop *loop
,gboolean may_block
);
Runs a single iteration for the given event loop. If no
events are ready and may_block
is TRUE
, waiting
for a event become ready. Otherwise, if may_block
is
FALSE
, events are not waited to become ready.
|
a GCutEventLoop. |
|
whether the call may block. |
Returns : |
TRUE if a event was dispatched. |
Since 1.1.6
void gcut_event_loop_quit (GCutEventLoop *loop
);
Stops the loop
from running.
|
a GCutEventLoop. |
Since 1.1.6
gboolean gcut_event_loop_remove (GCutEventLoop *loop
,guint tag
);
Removes the event with the given ID, tag
.
|
a GCutEventLoop. |
|
the ID of the source to remove |
Returns : |
TRUE if the source was found and removed. |
Since 1.1.6
void gcut_event_loop_run (GCutEventLoop *loop
);
Runs the given event loop until gcut_event_loop_quit()
is
called on the loop.
|
a GCutEventLoop. |
Since 1.1.6
guint gcut_event_loop_watch_child (GCutEventLoop *loop
,GPid pid
,GChildWatchFunc function
,gpointer data
);
Adds the function
to be called when the child indicated
by pid
exits into loop
with the default priority.
|
a GCutEventLoop. |
|
process ID to watch |
|
function to call |
|
data to pass to function
|
Returns : |
the event ID. |
Since 1.1.6
guint gcut_event_loop_watch_child_full (GCutEventLoop *loop
,gint priority
,GPid pid
,GChildWatchFunc function
,gpointer data
,GDestroyNotify notify
);
Adds the function
to be called when the child indicated
by pid
exits into loop
with the priority
.
|
a GCutEventLoop. |
|
the priority of the event. |
|
process ID to watch |
|
function to call |
|
data to pass to function
|
|
function to call when the event is removed, or NULL
|
Returns : |
the event ID. |
Since 1.1.6
guint gcut_event_loop_watch_io (GCutEventLoop *loop
,GIOChannel *channel
,GIOCondition condition
,GIOFunc function
,gpointer data
);
Adds the channel
into loop
with the default
priority. function
is called when condition
is met for
the given channel
.
|
a GCutEventLoop. |
|
a GIOChannel |
|
conditions to watch for |
|
function to call |
|
data to pass to function
|
Returns : |
the event ID. |
Since 1.1.6