123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616 |
- #ifndef __G_MAIN_H__
- #define __G_MAIN_H__
- #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
- #error "Only <glib.h> can be included directly."
- #endif
- #include <glib/gpoll.h>
- #include <glib/gslist.h>
- #include <glib/gthread.h>
- G_BEGIN_DECLS
- typedef enum
- {
- G_IO_IN GLIB_SYSDEF_POLLIN,
- G_IO_OUT GLIB_SYSDEF_POLLOUT,
- G_IO_PRI GLIB_SYSDEF_POLLPRI,
- G_IO_ERR GLIB_SYSDEF_POLLERR,
- G_IO_HUP GLIB_SYSDEF_POLLHUP,
- G_IO_NVAL GLIB_SYSDEF_POLLNVAL
- } GIOCondition;
- typedef struct _GMainContext GMainContext;
- typedef struct _GMainLoop GMainLoop;
- typedef struct _GSource GSource;
- typedef struct _GSourcePrivate GSourcePrivate;
- typedef struct _GSourceCallbackFuncs GSourceCallbackFuncs;
- typedef struct _GSourceFuncs GSourceFuncs;
- typedef gboolean (*GSourceFunc) (gpointer user_data);
- typedef void (*GChildWatchFunc) (GPid pid,
- gint status,
- gpointer user_data);
- struct _GSource
- {
-
- gpointer callback_data;
- GSourceCallbackFuncs *callback_funcs;
- const GSourceFuncs *source_funcs;
- guint ref_count;
- GMainContext *context;
- gint priority;
- guint flags;
- guint source_id;
- GSList *poll_fds;
-
- GSource *prev;
- GSource *next;
- char *name;
- GSourcePrivate *priv;
- };
- struct _GSourceCallbackFuncs
- {
- void (*ref) (gpointer cb_data);
- void (*unref) (gpointer cb_data);
- void (*get) (gpointer cb_data,
- GSource *source,
- GSourceFunc *func,
- gpointer *data);
- };
- typedef void (*GSourceDummyMarshal) (void);
- struct _GSourceFuncs
- {
- gboolean (*prepare) (GSource *source,
- gint *timeout_);
- gboolean (*check) (GSource *source);
- gboolean (*dispatch) (GSource *source,
- GSourceFunc callback,
- gpointer user_data);
- void (*finalize) (GSource *source);
-
-
- GSourceFunc closure_callback;
- GSourceDummyMarshal closure_marshal;
- };
- #define G_PRIORITY_HIGH -100
- #define G_PRIORITY_DEFAULT 0
- #define G_PRIORITY_HIGH_IDLE 100
- #define G_PRIORITY_DEFAULT_IDLE 200
- #define G_PRIORITY_LOW 300
- #define G_SOURCE_REMOVE FALSE
- #define G_SOURCE_CONTINUE TRUE
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_context_new (void);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_context_ref (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_unref (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_context_default (void);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_iteration (GMainContext *context,
- gboolean may_block);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_pending (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_main_context_find_source_by_id (GMainContext *context,
- guint source_id);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_main_context_find_source_by_user_data (GMainContext *context,
- gpointer user_data);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *context,
- GSourceFuncs *funcs,
- gpointer user_data);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_wakeup (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_acquire (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_release (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_is_owner (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_wait (GMainContext *context,
- GCond *cond,
- GMutex *mutex);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_context_prepare (GMainContext *context,
- gint *priority);
- GLIB_AVAILABLE_IN_ALL
- gint g_main_context_query (GMainContext *context,
- gint max_priority,
- gint *timeout_,
- GPollFD *fds,
- gint n_fds);
- GLIB_AVAILABLE_IN_ALL
- gint g_main_context_check (GMainContext *context,
- gint max_priority,
- GPollFD *fds,
- gint n_fds);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_dispatch (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_set_poll_func (GMainContext *context,
- GPollFunc func);
- GLIB_AVAILABLE_IN_ALL
- GPollFunc g_main_context_get_poll_func (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_add_poll (GMainContext *context,
- GPollFD *fd,
- gint priority);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_remove_poll (GMainContext *context,
- GPollFD *fd);
- GLIB_AVAILABLE_IN_ALL
- gint g_main_depth (void);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_main_current_source (void);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_push_thread_default (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_pop_thread_default (GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_context_get_thread_default (void);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_context_ref_thread_default (void);
- GLIB_AVAILABLE_IN_ALL
- GMainLoop *g_main_loop_new (GMainContext *context,
- gboolean is_running);
- GLIB_AVAILABLE_IN_ALL
- void g_main_loop_run (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- void g_main_loop_quit (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- GMainLoop *g_main_loop_ref (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- void g_main_loop_unref (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_main_loop_is_running (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_main_loop_get_context (GMainLoop *loop);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_source_new (GSourceFuncs *source_funcs,
- guint struct_size);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_source_ref (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_unref (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- guint g_source_attach (GSource *source,
- GMainContext *context);
- GLIB_AVAILABLE_IN_ALL
- void g_source_destroy (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_priority (GSource *source,
- gint priority);
- GLIB_AVAILABLE_IN_ALL
- gint g_source_get_priority (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_can_recurse (GSource *source,
- gboolean can_recurse);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_source_get_can_recurse (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- guint g_source_get_id (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- GMainContext *g_source_get_context (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_callback (GSource *source,
- GSourceFunc func,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_funcs (GSource *source,
- GSourceFuncs *funcs);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_source_is_destroyed (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_name (GSource *source,
- const char *name);
- GLIB_AVAILABLE_IN_ALL
- const char * g_source_get_name (GSource *source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_name_by_id (guint tag,
- const char *name);
- GLIB_AVAILABLE_IN_2_36
- void g_source_set_ready_time (GSource *source,
- gint64 ready_time);
- GLIB_AVAILABLE_IN_2_36
- gint64 g_source_get_ready_time (GSource *source);
- #ifdef G_OS_UNIX
- GLIB_AVAILABLE_IN_2_36
- gpointer g_source_add_unix_fd (GSource *source,
- gint fd,
- GIOCondition events);
- GLIB_AVAILABLE_IN_2_36
- void g_source_modify_unix_fd (GSource *source,
- gpointer tag,
- GIOCondition new_events);
- GLIB_AVAILABLE_IN_2_36
- void g_source_remove_unix_fd (GSource *source,
- gpointer tag);
- GLIB_AVAILABLE_IN_2_36
- GIOCondition g_source_query_unix_fd (GSource *source,
- gpointer tag);
- #endif
- GLIB_AVAILABLE_IN_ALL
- void g_source_set_callback_indirect (GSource *source,
- gpointer callback_data,
- GSourceCallbackFuncs *callback_funcs);
- GLIB_AVAILABLE_IN_ALL
- void g_source_add_poll (GSource *source,
- GPollFD *fd);
- GLIB_AVAILABLE_IN_ALL
- void g_source_remove_poll (GSource *source,
- GPollFD *fd);
- GLIB_AVAILABLE_IN_ALL
- void g_source_add_child_source (GSource *source,
- GSource *child_source);
- GLIB_AVAILABLE_IN_ALL
- void g_source_remove_child_source (GSource *source,
- GSource *child_source);
- GLIB_DEPRECATED_IN_2_28_FOR(g_source_get_time)
- void g_source_get_current_time (GSource *source,
- GTimeVal *timeval);
- GLIB_AVAILABLE_IN_ALL
- gint64 g_source_get_time (GSource *source);
-
- GLIB_AVAILABLE_IN_ALL
- GSource *g_idle_source_new (void);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_child_watch_source_new (GPid pid);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_timeout_source_new (guint interval);
- GLIB_AVAILABLE_IN_ALL
- GSource *g_timeout_source_new_seconds (guint interval);
- GLIB_AVAILABLE_IN_ALL
- void g_get_current_time (GTimeVal *result);
- GLIB_AVAILABLE_IN_ALL
- gint64 g_get_monotonic_time (void);
- GLIB_AVAILABLE_IN_ALL
- gint64 g_get_real_time (void);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_source_remove (guint tag);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_source_remove_by_user_data (gpointer user_data);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_source_remove_by_funcs_user_data (GSourceFuncs *funcs,
- gpointer user_data);
- GLIB_AVAILABLE_IN_ALL
- guint g_timeout_add_full (gint priority,
- guint interval,
- GSourceFunc function,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- guint g_timeout_add (guint interval,
- GSourceFunc function,
- gpointer data);
- GLIB_AVAILABLE_IN_ALL
- guint g_timeout_add_seconds_full (gint priority,
- guint interval,
- GSourceFunc function,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- guint g_timeout_add_seconds (guint interval,
- GSourceFunc function,
- gpointer data);
- GLIB_AVAILABLE_IN_ALL
- guint g_child_watch_add_full (gint priority,
- GPid pid,
- GChildWatchFunc function,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- guint g_child_watch_add (GPid pid,
- GChildWatchFunc function,
- gpointer data);
- GLIB_AVAILABLE_IN_ALL
- guint g_idle_add (GSourceFunc function,
- gpointer data);
- GLIB_AVAILABLE_IN_ALL
- guint g_idle_add_full (gint priority,
- GSourceFunc function,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- gboolean g_idle_remove_by_data (gpointer data);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_invoke_full (GMainContext *context,
- gint priority,
- GSourceFunc function,
- gpointer data,
- GDestroyNotify notify);
- GLIB_AVAILABLE_IN_ALL
- void g_main_context_invoke (GMainContext *context,
- GSourceFunc function,
- gpointer data);
- GLIB_VAR GSourceFuncs g_timeout_funcs;
- GLIB_VAR GSourceFuncs g_child_watch_funcs;
- GLIB_VAR GSourceFuncs g_idle_funcs;
- #ifdef G_OS_UNIX
- GLIB_VAR GSourceFuncs g_unix_signal_funcs;
- GLIB_VAR GSourceFuncs g_unix_fd_source_funcs;
- #endif
- G_END_DECLS
- #endif
|