📄 glib-the-main-event-loop.html
字号:
</div><p>Checks if any events are pending for the default <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a>(i.e. ready to be processed). </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><code class="literal">TRUE</code> if any events are pending.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2850745"></a><h3><a name="g-main-context-find-source-by-id"></a>g_main_context_find_source_by_id ()</h3><a class="indexterm" name="id2850757"></a><pre class="programlisting"><a href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* g_main_context_find_source_by_id (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a href="glib-Basic-Types.html#guint">guint</a> source_id);</pre><p>Finds a <a href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> given a pair of context and ID</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> (if <code class="literal">NULL</code>, the default context will be used)</td></tr><tr><td><span class="term"><em class="parameter"><code>source_id</code></em> :</span></td><td> the source ID, as returned by <a href="glib-The-Main-Event-Loop.html#g-source-get-id"><code class="function">g_source_get_id()</code></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the <a href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> if found, otherwise, <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2850888"></a><h3><a name="g-main-context-find-source-by-user-data"></a>g_main_context_find_source_by_user_data ()</h3><a class="indexterm" name="id2850900"></a><pre class="programlisting"><a href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* g_main_context_find_source_by_user_data (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Finds a source with the given user data for the callback. Ifmultiple sources exist with the same user data, the firstone found will be returned.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td> the user_data for the callback.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the source, if one was found, otherwise <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2851000"></a><h3><a name="g-main-context-find-source-by-funcs-user-data"></a>g_main_context_find_source_by_funcs_user_data ()</h3><a class="indexterm" name="id2851011"></a><pre class="programlisting"><a href="glib-The-Main-Event-Loop.html#GSource">GSource</a>* g_main_context_find_source_by_funcs_user_data (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context, <a href="glib-The-Main-Event-Loop.html#GSourceFuncs">GSourceFuncs</a> *funcs, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Finds a source with the given source functions and user data. Ifmultiple sources exist with the same source function and user data,the first one found will be returned.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a> (if <code class="literal">NULL</code>, the default context will be used).</td></tr><tr><td><span class="term"><em class="parameter"><code>funcs</code></em> :</span></td><td> the <em class="parameter"><code>source_funcs</code></em> passed to <a href="glib-The-Main-Event-Loop.html#g-source-new"><code class="function">g_source_new()</code></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td> the user data from the callback.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the source, if one was found, otherwise <code class="literal">NULL</code></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2851157"></a><h3><a name="g-main-context-wakeup"></a>g_main_context_wakeup ()</h3><a class="indexterm" name="id2851168"></a><pre class="programlisting">void g_main_context_wakeup (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);</pre><p>If <em class="parameter"><code>context</code></em> is currently waiting in a <code class="function">poll()</code>, interruptthe <code class="function">poll()</code>, and continue the iteration process.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2851255"></a><h3><a name="g-main-context-acquire"></a>g_main_context_acquire ()</h3><a class="indexterm" name="id2851266"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_main_context_acquire (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);</pre><p>Tries to become the owner of the specified context.If some other context is the owner of the context,returns <code class="literal">FALSE</code> immediately. Ownership is properlyrecursive: the owner can require ownership againand will release ownership when <a href="glib-The-Main-Event-Loop.html#g-main-context-release"><code class="function">g_main_context_release()</code></a>is called as many times as <a href="glib-The-Main-Event-Loop.html#g-main-context-acquire"><code class="function">g_main_context_acquire()</code></a>.</p><p>You must be the owner of a context before youcan call <a href="glib-The-Main-Event-Loop.html#g-main-context-prepare"><code class="function">g_main_context_prepare()</code></a>, <a href="glib-The-Main-Event-Loop.html#g-main-context-query"><code class="function">g_main_context_query()</code></a>,<a href="glib-The-Main-Event-Loop.html#g-main-context-check"><code class="function">g_main_context_check()</code></a>, <a href="glib-The-Main-Event-Loop.html#g-main-context-dispatch"><code class="function">g_main_context_dispatch()</code></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <code class="literal">TRUE</code> if the operation succeeded, and this thread is now the owner of <em class="parameter"><code>context</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2851426"></a><h3><a name="g-main-context-release"></a>g_main_context_release ()</h3><a class="indexterm" name="id2851437"></a><pre class="programlisting">void g_main_context_release (<a href="glib-The-Main-Event-Loop.html#GMainContext">GMainContext</a> *context);</pre><p>Releases ownership of a context previously acquired by this threadwith <a href="glib-The-Main-Event-Loop.html#g-main-context-acquire"><code class="function">g_main_context_acquire()</code></a>. If the context was acquired multipletimes, the only release ownership when <a href="glib-The-Main-Event-Loop.html#g-main-context-release"><code class="function">g_main_context_release()</code></a>is called as many times as it was acquired.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>context</code></em> :</span></td><td> a <a href="glib-The-Main-Event-Loop.html#GMainContext"><span class="type">GMainContext</span></a></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2851520"></a><h3><a name="g-main-context-wait"></a>g_main_context_wait ()</h3><a class="indexterm" name="id2851531"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboole
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -