?? glib-the-main-event-loop.html
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>The Main Event Loop</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-core.html" title="GLib Core Application Support"><link rel="prev" href="glib-core.html" title="GLib Core Application Support"><link rel="next" href="glib-Threads.html" title="Threads"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="index" href="ix01.html" title="Index"><link rel="index" href="ix02.html" title="Index of deprecated symbols"><link rel="index" href="ix03.html" title="Index of new symbols in 2.2"><link rel="index" href="ix04.html" title="Index of new symbols in 2.4"><link rel="index" href="ix05.html" title="Index of new symbols in 2.6"><link rel="index" href="ix06.html" title="Index of new symbols in 2.8"><link rel="index" href="ix07.html" title="Index of new symbols in 2.10"><link rel="index" href="ix08.html" title="Index of new symbols in 2.12"><link rel="index" href="ix09.html" title="Index of new symbols in 2.14"><link rel="index" href="ix10.html" title="Index of new symbols in 2.16"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-core.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-core.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-Threads.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id2854321" class="shortcut">Top</a>  |  <a href="#id2856540" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="glib-The-Main-Event-Loop"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id2854321"></a><span class="refentrytitle">The Main Event Loop</span></h2><p>The Main Event Loop — manages all available sources of events</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <glib.h> <a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a>;<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> is_running);<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-ref">g_main_loop_ref</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-unref">g_main_loop_unref</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-quit">g_main_loop_quit</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-is-running">g_main_loop_is_running</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-loop-get-context">g_main_loop_get_context</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainLoop">GMainLoop</a> *loop);#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-new">g_main_new</a> (is_running)#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-destroy">g_main_destroy</a> (loop)#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-run">g_main_run</a> (loop)#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-quit">g_main_quit</a> (loop)#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-is-running">g_main_is_running</a> (loop)#define <a class="link" href="glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH:CAPS">G_PRIORITY_HIGH</a>#define <a class="link" href="glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT:CAPS">G_PRIORITY_DEFAULT</a>#define <a class="link" href="glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH-IDLE:CAPS">G_PRIORITY_HIGH_IDLE</a>#define <a class="link" href="glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT-IDLE:CAPS">G_PRIORITY_DEFAULT_IDLE</a>#define <a class="link" href="glib-The-Main-Event-Loop.html#G-PRIORITY-LOW:CAPS">G_PRIORITY_LOW</a> <a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>;<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-new">g_main_context_new</a> (void);<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-ref">g_main_context_ref</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-unref">g_main_context_unref</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-default">g_main_context_default</a> (void);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-iteration">g_main_context_iteration</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> may_block);#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-iteration">g_main_iteration</a> (may_block)<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-pending">g_main_context_pending</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-pending">g_main_pending</a> ()<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-find-source-by-id">g_main_context_find_source_by_id</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#guint">guint</a> source_id);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-find-source-by-user-data">g_main_context_find_source_by_user_data</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-find-source-by-funcs-user-data">g_main_context_find_source_by_funcs_user_data</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFuncs">GSourceFuncs</a> *funcs, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-wakeup">g_main_context_wakeup</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-acquire">g_main_context_acquire</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-release">g_main_context_release</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-is-owner">g_main_context_is_owner</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-wait">g_main_context_wait</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Threads.html#GCond">GCond</a> *cond, <a class="link" href="glib-Threads.html#GMutex">GMutex</a> *mutex);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-prepare">g_main_context_prepare</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gint">gint</a> *priority);<a class="link" href="glib-Basic-Types.html#gint">gint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-query">g_main_context_query</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gint">gint</a> max_priority, <a class="link" href="glib-Basic-Types.html#gint">gint</a> *timeout_, <a class="link" href="glib-The-Main-Event-Loop.html#GPollFD">GPollFD</a> *fds, <a class="link" href="glib-Basic-Types.html#gint">gint</a> n_fds);<a class="link" href="glib-Basic-Types.html#gint">gint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-check">g_main_context_check</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-Basic-Types.html#gint">gint</a> max_priority, <a class="link" href="glib-The-Main-Event-Loop.html#GPollFD">GPollFD</a> *fds, <a class="link" href="glib-Basic-Types.html#gint">gint</a> n_fds);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-dispatch">g_main_context_dispatch</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-set-poll-func">g_main_context_set_poll_func</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-The-Main-Event-Loop.html#GPollFunc">GPollFunc</a> func);<a class="link" href="glib-The-Main-Event-Loop.html#GPollFunc">GPollFunc</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-get-poll-func">g_main_context_get_poll_func</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);<a class="link" href="glib-Basic-Types.html#gint">gint</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GPollFunc">*GPollFunc</a>) (<a class="link" href="glib-The-Main-Event-Loop.html#GPollFD">GPollFD</a> *ufds, <a class="link" href="glib-Basic-Types.html#guint">guint</a> nfsd, <a class="link" href="glib-Basic-Types.html#gint">gint</a> timeout_);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-add-poll">g_main_context_add_poll</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-The-Main-Event-Loop.html#GPollFD">GPollFD</a> *fd, <a class="link" href="glib-Basic-Types.html#gint">gint</a> priority);void <a class="link" href="glib-The-Main-Event-Loop.html#g-main-context-remove-poll">g_main_context_remove_poll</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a class="link" href="glib-The-Main-Event-Loop.html#GPollFD">GPollFD</a> *fd);<a class="link" href="glib-Basic-Types.html#gint">gint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-main-depth">g_main_depth</a> (void);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-main-current-source">g_main_current_source</a> (void);#define <a class="link" href="glib-The-Main-Event-Loop.html#g-main-set-poll-func">g_main_set_poll_func</a> (func)<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-source-new">g_timeout_source_new</a> (<a class="link" href="glib-Basic-Types.html#guint">guint</a> interval);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-source-new-seconds">g_timeout_source_new_seconds</a> (<a class="link" href="glib-Basic-Types.html#guint">guint</a> interval);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-add">g_timeout_add</a> (<a class="link" href="glib-Basic-Types.html#guint">guint</a> interval, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-add-full">g_timeout_add_full</a> (<a class="link" href="glib-Basic-Types.html#gint">gint</a> priority, <a class="link" href="glib-Basic-Types.html#guint">guint</a> interval, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-add-seconds">g_timeout_add_seconds</a> (<a class="link" href="glib-Basic-Types.html#guint">guint</a> interval, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-timeout-add-seconds-full">g_timeout_add_seconds_full</a> (<a class="link" href="glib-Basic-Types.html#gint">gint</a> priority, <a class="link" href="glib-Basic-Types.html#guint">guint</a> interval, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-idle-source-new">g_idle_source_new</a> (void);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-idle-add">g_idle_add</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-idle-add-full">g_idle_add_full</a> (<a class="link" href="glib-Basic-Types.html#gint">gint</a> priority, <a class="link" href="glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data, <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-idle-remove-by-data">g_idle_remove_by_data</a> (<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);typedef <a class="link" href="glib-The-Main-Event-Loop.html#GPid">GPid</a>;void (<a class="link" href="glib-The-Main-Event-Loop.html#GChildWatchFunc">*GChildWatchFunc</a>) (<a class="link" href="glib-The-Main-Event-Loop.html#GPid">GPid</a> pid, <a class="link" href="glib-Basic-Types.html#gint">gint</a> status, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* <a class="link" href="glib-The-Main-Event-Loop.html#g-child-watch-source-new">g_child_watch_source_new</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GPid">GPid</a> pid);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-child-watch-add">g_child_watch_add</a> (<a class="link" href="glib-The-Main-Event-Loop.html#GPid">GPid</a> pid, <a class="link" href="glib-The-Main-Event-Loop.html#GChildWatchFunc">GChildWatchFunc</a> function, <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-The-Main-Event-Loop.html#g-child-watch-add-full">g_child_watch_add_full</a> (<a class="link" href="glib-Basic-Types.html#gint">gint</a> priority, <a class="link" href="glib-The-Main-Event-Loop.html#GPid">GPid</a> pid, <a class="link" href="glib-The-Main-Event-Loop.html#GChildWatchFunc">GChildWatchFunc</a> function,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -