7
7
<link rel="home" href="index.html" title="GIO Reference Manual">
8
8
<link rel="up" href="async.html" title="Asynchronous I/O">
9
9
<link rel="prev" href="GCancellable.html" title="GCancellable">
10
<link rel="next" href="gio-GIOScheduler.html" title="GIOScheduler">
11
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
10
<link rel="next" href="GTask.html" title="GTask">
11
<meta name="generator" content="GTK-Doc V1.18.1 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
14
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
49
49
<a class="link" href="GAsyncResult.html#GAsyncResult-struct" title="GAsyncResult">GAsyncResult</a>;
50
50
struct <a class="link" href="GAsyncResult.html#GAsyncResultIface" title="struct GAsyncResultIface">GAsyncResultIface</a>;
51
<span class="returnvalue">void</span> (<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">*GAsyncReadyCallback</a>) (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *source_object</code></em>,
51
<span class="returnvalue">void</span> (<a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()">*GAsyncReadyCallback</a>) (<em class="parameter"><code><a href="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *source_object</code></em>,
52
52
<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
53
<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
54
<a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GAsyncResult.html#g-async-result-get-user-data" title="g_async_result_get_user_data ()">g_async_result_get_user_data</a> (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>);
55
<a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * <a class="link" href="GAsyncResult.html#g-async-result-get-source-object" title="g_async_result_get_source_object ()">g_async_result_get_source_object</a> (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>);
53
<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
54
<a href="../glib/glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> <a class="link" href="GAsyncResult.html#g-async-result-get-user-data" title="g_async_result_get_user_data ()">g_async_result_get_user_data</a> (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>);
55
<a href="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="returnvalue">GObject</span></a> * <a class="link" href="GAsyncResult.html#g-async-result-get-source-object" title="g_async_result_get_source_object ()">g_async_result_get_source_object</a> (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>);
56
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GAsyncResult.html#g-async-result-is-tagged" title="g_async_result_is_tagged ()">g_async_result_is_tagged</a> (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
57
<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);
58
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GAsyncResult.html#g-async-result-legacy-propagate-error" title="g_async_result_legacy_propagate_error ()">g_async_result_legacy_propagate_error</a>
59
(<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
60
<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
58
63
<div class="refsect1">
100
105
operation is not needed, there is no need to call the "<code class="function">_finish()</code>"
101
106
function; GIO will take care of cleaning up the result and error
102
107
information after the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> returns. You can pass
103
<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> if you don't need to take any
108
<a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> if you don't need to take any
104
109
action at all after the operation completes. Applications may also
105
110
take a reference to the <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> and call "<code class="function">_finish()</code>" later;
106
111
however, the "<code class="function">_finish()</code>" function may be called at most once.
164
169
<span class="normal"> </span><span class="usertype">GAsyncResult</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">res</span><span class="symbol">,</span>
165
170
<span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
166
171
<span class="cbracket">{</span>
167
<span class="normal"> </span><span class="usertype">gboolean</span><span class="normal"> success </span><span class="symbol">=</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">;</span>
172
<span class="normal"> </span><span class="usertype">gboolean</span><span class="normal"> success </span><span class="symbol">=</span><span class="normal"> <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">;</span>
169
<span class="normal"> success </span><span class="symbol">=</span><span class="normal"> </span><span class="function">_theoretical_frobnitz_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">source_object</span><span class="symbol">,</span><span class="normal"> res</span><span class="symbol">,</span><span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
174
<span class="normal"> success </span><span class="symbol">=</span><span class="normal"> </span><span class="function">_theoretical_frobnitz_finish</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">source_object</span><span class="symbol">,</span><span class="normal"> res</span><span class="symbol">,</span><span class="normal"> <a href="../glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
171
176
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">success</span><span class="symbol">)</span>
172
<span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-String-Utility-Functions.html#g-printf">g_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Hurray!</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
177
<span class="normal"> </span><span class="function"><a href="../glib/glib-String-Utility-Functions.html#g-printf">g_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Hurray!</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
173
178
<span class="normal"> </span><span class="keyword">else</span>
174
<span class="normal"> </span><span class="function"><a href="./../glib/glib/glib-String-Utility-Functions.html#g-printf">g_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Uh oh!</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
179
<span class="normal"> </span><span class="function"><a href="../glib/glib-String-Utility-Functions.html#g-printf">g_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Uh oh!</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">);</span>
176
181
<span class="normal"> </span><span class="comment">/* ... */</span>
182
187
<span class="normal"> </span><span class="comment">/* ... */</span>
184
189
<span class="normal"> </span><span class="function">_theoretical_frobnitz_async</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">theoretical_data</span><span class="symbol">,</span>
185
<span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
190
<span class="normal"> <a href="../glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
186
191
<span class="normal"> frobnitz_result_func</span><span class="symbol">,</span>
187
<span class="normal"> <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
192
<span class="normal"> <a href="../glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
189
194
<span class="normal"> </span><span class="comment">/* ... */</span>
190
195
<span class="cbracket">}</span></pre></td>
200
205
always called, even in the case of a cancelled operation. On cancellation
201
206
the 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.
210
<p><a name="io-priority"></a> Many I/O-related asynchronous
211
operations have a priority parameter, which is used in certain
212
cases to determine the order in which operations are executed. They
213
are <span class="emphasis"><em>not</em></span> used to determine system-wide I/O
214
scheduling. Priorities are integers, with lower numbers indicating
215
higher priority. It is recommended to choose priorities between
216
<a href="../glib/glib-The-Main-Event-Loop.html#G-PRIORITY-LOW:CAPS"><code class="literal">G_PRIORITY_LOW</code></a> and <a href="../glib/glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH:CAPS"><code class="literal">G_PRIORITY_HIGH</code></a>, with <a href="../glib/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT:CAPS"><code class="literal">G_PRIORITY_DEFAULT</code></a> as a
204
221
<div class="refsect1">
205
222
<a name="GAsyncResult.details"></a><h2>Details</h2>
244
264
<td><p><span class="term"><em class="structfield"><code><a name="GAsyncResultIface.get-source-object"></a>get_source_object</code></em> ()</span></p></td>
245
265
<td>Gets the source object that issued the asynchronous operation.</td>
268
<td><p><span class="term"><em class="structfield"><code><a name="GAsyncResultIface.is-tagged"></a>is_tagged</code></em> ()</span></p></td>
269
<td>Checks if a result is tagged with a particular source.</td>
251
275
<div class="refsect2">
252
276
<a name="GAsyncReadyCallback"></a><h3>GAsyncReadyCallback ()</h3>
253
<pre class="programlisting"><span class="returnvalue">void</span> (*GAsyncReadyCallback) (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *source_object</code></em>,
277
<pre class="programlisting"><span class="returnvalue">void</span> (*GAsyncReadyCallback) (<em class="parameter"><code><a href="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *source_object</code></em>,
254
278
<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
255
<em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
279
<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
257
281
Type definition for a function that will be called back when an asynchronous
258
282
operation within GIO has been completed.
325
349
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
326
350
<td>a new reference to the source object for the <em class="parameter"><code>res</code></em>,
327
or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if there is none. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
351
or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if there is none. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
358
<div class="refsect2">
359
<a name="g-async-result-is-tagged"></a><h3>g_async_result_is_tagged ()</h3>
360
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_async_result_is_tagged (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
361
<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);</pre>
363
Checks if <em class="parameter"><code>res</code></em> has the given <em class="parameter"><code>source_tag</code></em> (generally a function
364
pointer indicating the function <em class="parameter"><code>res</code></em> was created by).
366
<div class="variablelist"><table border="0" class="variablelist">
368
<col align="left" valign="top">
373
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
374
<td>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>
378
<td><p><span class="term"><em class="parameter"><code>source_tag</code></em> :</span></p></td>
379
<td>an application-defined tag</td>
382
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
384
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>res</code></em> has the indicated <em class="parameter"><code>source_tag</code></em>, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if
389
<p class="since">Since 2.34</p>
392
<div class="refsect2">
393
<a name="g-async-result-legacy-propagate-error"></a><h3>g_async_result_legacy_propagate_error ()</h3>
394
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_async_result_legacy_propagate_error
395
(<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
396
<em class="parameter"><code><a href="../glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
398
If <em class="parameter"><code>res</code></em> is a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>, this is equivalent to
399
<a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error" title="g_simple_async_result_propagate_error ()"><code class="function">g_simple_async_result_propagate_error()</code></a>. Otherwise it returns
400
<a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.
403
This can be used for legacy error handling in async
404
<code class="literal"><code class="function">_finish()</code></code> wrapper functions that traditionally
405
handled <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> error returns themselves rather than
406
calling into the virtual method. This should not be used in new
407
code; <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> errors that are set by virtual methods should
408
also be extracted by virtual methods, to enable subclasses to chain
411
<div class="variablelist"><table border="0" class="variablelist">
413
<col align="left" valign="top">
418
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
419
<td>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>
423
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
424
<td>a location to propagate the error to. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
428
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
430
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>error</code></em> is has been filled in with an error from
431
<em class="parameter"><code>res</code></em>, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</td>
435
<p class="since">Since 2.34</p>
334
438
<div class="refsect1">
335
439
<a name="GAsyncResult.see-also"></a><h2>See Also</h2>
336
<a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>
440
<a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>
339
443
<div class="footer">
341
Generated by GTK-Doc V1.18</div>
445
Generated by GTK-Doc V1.18.1</div>
b'\\ No newline at end of file'