📄 gasyncresult.html
字号:
<p></p><p>The callback for an asynchronous operation is called only once, and isalways called, even in the case of a cancelled operation. On cancellationthe result is a <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a> error.</p><p>Some ascynchronous operations are implemented using synchronous calls. Theseare run in a separate thread, if <ahref="/usr/share/gtk-doc/html/glib/glib-Threads.html#GThread"><span class="type">GThread</span></a> has been initialized, but otherwise theyare sent to the Main Event Loop and processed in an idle function. So, if youtruly need asynchronous operations, make sure to initialize <ahref="/usr/share/gtk-doc/html/glib/glib-Threads.html#GThread"><span class="type">GThread</span></a>.</p><p></p></div><div class="refsect1" lang="en"><a name="id3104614"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3104624"></a><h3><a name="GAsyncResult-struct"></a>GAsyncResult</h3><a class="indexterm" name="id3145486"></a><pre class="programlisting">typedef struct _GAsyncResult GAsyncResult;</pre><p>Holds results information for an asynchronous operation, usually passed directly to a asynchronous <code class="function">_finish()</code> operation.</p><p></p></div><hr><div class="refsect2" lang="en"><a name="id3145516"></a><h3><a name="GAsyncResultIface"></a>GAsyncResultIface</h3><a class="indexterm" name="id3145528"></a><pre class="programlisting">typedef struct { GTypeInterface g_iface; /* Virtual Table */ gpointer (*get_user_data) (GAsyncResult *async_result); GObject * (*get_source_object) (GAsyncResult *async_result);} GAsyncResultIface;</pre><p>Interface definition for <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GTypeInterface">GTypeInterface</a> <em class="structfield"><code>g_iface</code></em>;</span></p></td><td> The parent interface. </td></tr><tr><td><p><span class="term"><em class="structfield"><code>get_user_data</code></em> ()</span></p></td><td> Gets the user data passed to the callback.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>get_source_object</code></em> ()</span></p></td><td> Gets the source object that issued the asynchronous operation.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3145615"></a><h3><a name="GAsyncReadyCallback"></a>GAsyncReadyCallback ()</h3><a class="indexterm" name="id3145628"></a><pre class="programlisting">void (*GAsyncReadyCallback) (<ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a> *source_object, <a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *res, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Type definition for a function that will be called back when an asynchronous operation within GIO has been completed.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>source_object</code></em> :</span></p></td><td> the object the asynchronous operation was started with.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td><td> a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td><td> user data passed to the callback.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3145730"></a><h3><a name="g-async-result-get-user-data"></a>g_async_result_get_user_data ()</h3><a class="indexterm" name="id3145741"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> g_async_result_get_user_data (<a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *res);</pre><p>Gets the user data from a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td><td> a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the user data for <em class="parameter"><code>res</code></em>. </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3145823"></a><h3><a name="g-async-result-get-source-object"></a>g_async_result_get_source_object ()</h3><a class="indexterm" name="id3145836"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>* g_async_result_get_source_object (<a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *res);</pre><p>Gets the source object from a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td><td> a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the source object for the <em class="parameter"><code>res</code></em>.</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id3136037"></a><h2>See Also</h2><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a></div><div class="refsect1" lang="en"><a name="id3136051"></a><div class="refsect2" lang="en"><a name="id3136052"></a></div><hr><div class="refsect2" lang="en"><a name="id3136054"></a></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -