抽象化されたイベントループ

抽象化されたイベントループ — GCutterで使うイベントループをカスタマイズするための抽象化されたイベントループAPI。

Functions

オブジェクト階層

    GObject
    ╰── GCutEventLoop

説明

GCutEventLoopはイベントループをカプセル化します。イベントループはGCutProcessで使われています。GCutProcessはデフォルトではGLibのデフォルトGMainContextを使います。

ふつうはカスタムGCutEventLoopは必要ありません。必要になるのは特別な場合だけです。例えば、イベントループのバックエンドにGLibのGMainLoopではなく、libevのイベントループに使っている場合です。

GCutterはGLibのGMainContextとGMainLoop用のGCutEventLoopであるGCutGLibEventLoopを提供します。

Functions

GCUT_EVENT_LOOP_ERROR

#define GCUT_EVENT_LOOP_ERROR           (gcut_event_loop_error_quark())


gcut_event_loop_error_quark ()

GQuark
gcut_event_loop_error_quark (void);


gcut_event_loop_run ()

void
gcut_event_loop_run (GCutEventLoop *loop);

gcut_event_loop_quit()が呼ばれるまでイベントループを回します。

Parameters

loop

GCutEventLoop

 

Since: 1.1.6


gcut_event_loop_iterate ()

gboolean
gcut_event_loop_iterate (GCutEventLoop *loop,
                         gboolean may_block);

イベントループを1回だけ回します。もし、イベントがなくmay_blockTRUEなら、イベントがくるまで待ちつづけます。may_blockFALSEなら、イベントがくるのを待ちません。

Parameters

loop

GCutEventLoop

 

may_block

呼び出しがブロックするかどうか。

 

Returns

イベントを処理したらTRUE

Since: 1.1.6


gcut_event_loop_quit ()

void
gcut_event_loop_quit (GCutEventLoop *loop);

実行中のloopを止めます。

Parameters

loop

GCutEventLoop

 

Since: 1.1.6


gcut_event_loop_watch_io ()

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 .

Parameters

loop

GCutEventLoop

 

channel

GIOChannel

 

condition

監視する状態。

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_watch_child ()

guint
gcut_event_loop_watch_child (GCutEventLoop *loop,
                             GPid pid,
                             GChildWatchFunc function,
                             gpointer data);

pidの子プロセスが終了した時に呼ばれるfunctionをデフォルトの優先度でloopに追加します。

Parameters

loop

GCutEventLoop

 

pid

監視するプロセスのID

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_watch_child_full ()

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 .

Parameters

loop

GCutEventLoop

 

priority

このイベントの優先度。

 

pid

監視するプロセスのID

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

notify

このイベントが削除された時に呼ばれる関数またはNULL

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_add_timeout ()

guint
gcut_event_loop_add_timeout (GCutEventLoop *loop,
                             gdouble interval_in_seconds,
                             GSourceFunc function,
                             gpointer data);

一定間隔で呼び出されるfunctionをデフォルト優先度で追加します。

Parameters

loop

GCutEventLoop

 

interval_in_seconds

the time between calls to the function , in seconds.

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_add_timeout_full ()

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 .

Parameters

loop

GCutEventLoop

 

priority

このイベントの優先度。

 

interval_in_seconds

the time between calls to the function , in seconds.

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

notify

このイベントが削除された時に呼ばれる関数またはNULL

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_add_idle ()

guint
gcut_event_loop_add_idle (GCutEventLoop *loop,
                          GSourceFunc function,
                          gpointer data);

デフォルト優先度より高い優先度がない場合に呼び出される関数functionを追加します。

Parameters

loop

GCutEventLoop

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_add_idle_full ()

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 .

Parameters

loop

GCutEventLoop

 

priority

このイベントの優先度。

 

function

呼び出される関数

 

data

functionに渡されるデータ

 

notify

このイベントが削除された時に呼ばれる関数またはNULL

 

Returns

イベントID。

Since: 1.1.6


gcut_event_loop_remove ()

gboolean
gcut_event_loop_remove (GCutEventLoop *loop,
                        guint tag);

Removes the event with the given ID, tag .

Parameters

loop

GCutEventLoop

 

tag

削除するソースのID。

 

Returns

ソースが見つかって削除されたらTRUE

Since: 1.1.6

Types and Values