14
14
<refname>GAsyncResult</refname>
15
15
<refpurpose>Asynchronous Function Results</refpurpose>
16
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
19
<refsynopsisdiv role="synopsis">
18
<refsynopsisdiv id="GAsyncResult.synopsis" role="synopsis">
20
19
<title role="synopsis.title">Synopsis</title>
24
23
#include <gio/gio.h>
27
25
<link linkend="GAsyncResult-struct">GAsyncResult</link>;
28
26
<link linkend="GAsyncResultIface">GAsyncResultIface</link>;
29
27
<link linkend="void">void</link> (<link linkend="GAsyncReadyCallback">*GAsyncReadyCallback</link>) (<link linkend="GObject">GObject</link> *source_object,
30
28
<link linkend="GAsyncResult">GAsyncResult</link> *res,
31
29
<link linkend="gpointer">gpointer</link> user_data);
32
30
<link linkend="gpointer">gpointer</link> <link linkend="g-async-result-get-user-data">g_async_result_get_user_data</link> (<link linkend="GAsyncResult">GAsyncResult</link> *res);
33
<link linkend="GObject">GObject</link>* <link linkend="g-async-result-get-source-object">g_async_result_get_source_object</link> (<link linkend="GAsyncResult">GAsyncResult</link> *res);
31
<link linkend="GObject">GObject</link> * <link linkend="g-async-result-get-source-object">g_async_result_get_source_object</link> (<link linkend="GAsyncResult">GAsyncResult</link> *res);
39
<refsect1 role="object_hierarchy">
35
<refsect1 id="GAsyncResult.object-hierarchy" role="object_hierarchy">
40
36
<title role="object_hierarchy.title">Object Hierarchy</title>
43
38
<link linkend="GInterface">GInterface</link>
49
<refsect1 role="prerequisites">
43
<refsect1 id="GAsyncResult.prerequisites" role="prerequisites">
50
44
<title role="prerequisites.title">Prerequisites</title>
52
46
GAsyncResult requires
53
47
<link linkend="GObject">GObject</link>.</para>
59
<refsect1 role="implementations">
52
<refsect1 id="GAsyncResult.implementations" role="implementations">
60
53
<title role="implementations.title">Known Implementations</title>
62
55
GAsyncResult is implemented by
63
56
<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link>.</para>
70
<refsect1 role="desc">
62
<refsect1 id="GAsyncResult.description" role="desc">
71
63
<title role="desc.title">Description</title>
73
65
Provides a base class for implementing asynchronous function results.
150
142
are sent to the Main Event Loop and processed in an idle function. So, if you
151
143
truly need asynchronous operations, make sure to initialize <link linkend="GThread"><type>GThread</type></link>.</para>
157
<refsect1 role="details">
148
<refsect1 id="GAsyncResult.details" role="details">
158
149
<title role="details.title">Details</title>
160
<title><anchor id="GAsyncResult-struct" role="struct"/>GAsyncResult</title>
161
<indexterm><primary>GAsyncResult</primary></indexterm><programlisting>typedef struct _GAsyncResult GAsyncResult;</programlisting>
150
<refsect2 id="GAsyncResult-struct" role="struct">
151
<title>GAsyncResult</title>
152
<indexterm zone="GAsyncResult-struct"><primary sortas="GAsyncResult">GAsyncResult</primary></indexterm><programlisting>typedef struct _GAsyncResult GAsyncResult;</programlisting>
163
Holds results information for an asynchronous operation,
154
Holds results information for an asynchronous operation,
164
155
usually passed directly to a asynchronous <link linkend="finish"><function>_finish()</function></link> operation.</para>
167
157
</para></refsect2>
169
<title><anchor id="GAsyncResultIface" role="struct"/>GAsyncResultIface</title>
170
<indexterm><primary>GAsyncResultIface</primary></indexterm><programlisting>typedef struct {
158
<refsect2 id="GAsyncResultIface" role="struct">
159
<title>GAsyncResultIface</title>
160
<indexterm zone="GAsyncResultIface"><primary sortas="GAsyncResultIface">GAsyncResultIface</primary></indexterm><programlisting>typedef struct {
171
161
GTypeInterface g_iface;
173
163
/* Virtual Table */
175
gpointer (*get_user_data) (GAsyncResult *async_result);
176
GObject * (*get_source_object) (GAsyncResult *async_result);
165
gpointer (* get_user_data) (GAsyncResult *async_result);
166
GObject * (* get_source_object) (GAsyncResult *async_result);
177
167
} GAsyncResultIface;
178
168
</programlisting>
180
170
Interface definition for <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.</para>
183
172
</para><variablelist role="struct">
185
<term><link linkend="GTypeInterface">GTypeInterface</link> <structfield>g_iface</structfield>;</term>
186
<listitem><simpara> The parent interface.
174
<term><link linkend="GTypeInterface">GTypeInterface</link> <structfield>g_iface</structfield>;</term>
175
<listitem><simpara> The parent interface.
187
176
</simpara></listitem>
190
<term><structfield>get_user_data</structfield> ()</term>
179
<term><structfield>get_user_data</structfield> ()</term>
191
180
<listitem><simpara> Gets the user data passed to the callback.
192
181
</simpara></listitem>
195
<term><structfield>get_source_object</structfield> ()</term>
184
<term><structfield>get_source_object</structfield> ()</term>
196
185
<listitem><simpara> Gets the source object that issued the asynchronous operation.
197
186
</simpara></listitem>
199
188
</variablelist></refsect2>
201
<title><anchor id="GAsyncReadyCallback" role="function"/>GAsyncReadyCallback ()</title>
202
<indexterm><primary>GAsyncReadyCallback</primary></indexterm><programlisting><link linkend="void">void</link> (*GAsyncReadyCallback) (<link linkend="GObject">GObject</link> *source_object,
189
<refsect2 id="GAsyncReadyCallback" role="function">
190
<title>GAsyncReadyCallback ()</title>
191
<indexterm zone="GAsyncReadyCallback"><primary sortas="GAsyncReadyCallback">GAsyncReadyCallback</primary></indexterm><programlisting><link linkend="void">void</link> (*GAsyncReadyCallback) (<link linkend="GObject">GObject</link> *source_object,
203
192
<link linkend="GAsyncResult">GAsyncResult</link> *res,
204
193
<link linkend="gpointer">gpointer</link> user_data);</programlisting>
206
Type definition for a function that will be called back when an asynchronous
195
Type definition for a function that will be called back when an asynchronous
207
196
operation within GIO has been completed.</para>
210
198
</para><variablelist role="params">
211
<varlistentry><term><parameter>source_object</parameter> :</term>
199
<varlistentry><term><parameter>source_object</parameter> :</term>
212
200
<listitem><simpara> the object the asynchronous operation was started with.
213
201
</simpara></listitem></varlistentry>
214
<varlistentry><term><parameter>res</parameter> :</term>
202
<varlistentry><term><parameter>res</parameter> :</term>
215
203
<listitem><simpara> a <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.
216
204
</simpara></listitem></varlistentry>
217
<varlistentry><term><parameter>user_data</parameter> :</term>
205
<varlistentry><term><parameter>user_data</parameter> :</term>
218
206
<listitem><simpara> user data passed to the callback.
219
207
</simpara></listitem></varlistentry>
220
208
</variablelist></refsect2>
222
<title><anchor id="g-async-result-get-user-data" role="function"/>g_async_result_get_user_data ()</title>
223
<indexterm><primary>g_async_result_get_user_data</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_async_result_get_user_data (<link linkend="GAsyncResult">GAsyncResult</link> *res);</programlisting>
209
<refsect2 id="g-async-result-get-user-data" role="function">
210
<title>g_async_result_get_user_data ()</title>
211
<indexterm zone="g-async-result-get-user-data"><primary sortas="g_async_result_get_user_data">g_async_result_get_user_data</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link> g_async_result_get_user_data (<link linkend="GAsyncResult">GAsyncResult</link> *res);</programlisting>
225
213
Gets the user data from a <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.</para>
228
215
</para><variablelist role="params">
229
<varlistentry><term><parameter>res</parameter> :</term>
216
<varlistentry><term><parameter>res</parameter> :</term>
230
217
<listitem><simpara> a <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.
231
218
</simpara></listitem></varlistentry>
232
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the user data for <parameter>res</parameter>.
219
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the user data for <parameter>res</parameter>.
233
220
</simpara></listitem></varlistentry>
234
221
</variablelist></refsect2>
236
<title><anchor id="g-async-result-get-source-object" role="function"/>g_async_result_get_source_object ()</title>
237
<indexterm><primary>g_async_result_get_source_object</primary></indexterm><programlisting><link linkend="GObject">GObject</link>* g_async_result_get_source_object (<link linkend="GAsyncResult">GAsyncResult</link> *res);</programlisting>
222
<refsect2 id="g-async-result-get-source-object" role="function">
223
<title>g_async_result_get_source_object ()</title>
224
<indexterm zone="g-async-result-get-source-object"><primary sortas="g_async_result_get_source_object">g_async_result_get_source_object</primary></indexterm><programlisting><link linkend="GObject">GObject</link> * g_async_result_get_source_object (<link linkend="GAsyncResult">GAsyncResult</link> *res);</programlisting>
239
226
Gets the source object from a <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.</para>
242
228
</para><variablelist role="params">
243
<varlistentry><term><parameter>res</parameter> :</term>
229
<varlistentry><term><parameter>res</parameter> :</term>
244
230
<listitem><simpara> a <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.
245
231
</simpara></listitem></varlistentry>
246
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the source object for the <parameter>res</parameter>.
232
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the source object for the <parameter>res</parameter>.
247
233
</simpara></listitem></varlistentry>
248
234
</variablelist></refsect2>