<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GSimpleAsyncResult">
<refmeta>
<refentrytitle role="top_of_page" id="GSimpleAsyncResult.top_of_page">GSimpleAsyncResult</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GSimpleAsyncResult</refname>
<refpurpose>Simple asynchronous results implementation</refpurpose>
</refnamediv>

<refsynopsisdiv id="GSimpleAsyncResult.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gio/gio.h&gt;

                    <link linkend="GSimpleAsyncResult-struct">GSimpleAsyncResult</link>;
<link linkend="void">void</link>                (<link linkend="GSimpleAsyncThreadFunc">*GSimpleAsyncThreadFunc</link>)           (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *res,
                                                         <link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable);
<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * <link linkend="g-simple-async-result-new">g_simple_async_result_new</link>          (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="gpointer">gpointer</link> source_tag);
<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * <link linkend="g-simple-async-result-new-error">g_simple_async_result_new_error</link>    (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);
<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * <link linkend="g-simple-async-result-new-from-error">g_simple_async_result_new_from_error</link>
                                                        (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GError">GError</link> *error);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-op-res-gpointer">g_simple_async_result_set_op_res_gpointer</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gpointer">gpointer</link> op_res,
                                                         <link linkend="GDestroyNotify">GDestroyNotify</link> destroy_op_res);
<link linkend="gpointer">gpointer</link>            <link linkend="g-simple-async-result-get-op-res-gpointer">g_simple_async_result_get_op_res_gpointer</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-op-res-gssize">g_simple_async_result_set_op_res_gssize</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gssize">gssize</link> op_res);
<link linkend="gssize">gssize</link>              <link linkend="g-simple-async-result-get-op-res-gssize">g_simple_async_result_get_op_res_gssize</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-op-res-gboolean">g_simple_async_result_set_op_res_gboolean</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gboolean">gboolean</link> op_res);
<link linkend="gboolean">gboolean</link>            <link linkend="g-simple-async-result-get-op-res-gboolean">g_simple_async_result_get_op_res_gboolean</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="gpointer">gpointer</link>            <link linkend="g-simple-async-result-get-source-tag">g_simple_async_result_get_source_tag</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="gboolean">gboolean</link>            <link linkend="g-simple-async-result-is-valid">g_simple_async_result_is_valid</link>      (<link linkend="GAsyncResult">GAsyncResult</link> *result,
                                                         <link linkend="GObject">GObject</link> *source,
                                                         <link linkend="gpointer">gpointer</link> source_tag);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-handle-cancellation">g_simple_async_result_set_handle_cancellation</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gboolean">gboolean</link> handle_cancellation);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-complete">g_simple_async_result_complete</link>      (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-complete-in-idle">g_simple_async_result_complete_in_idle</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-run-in-thread">g_simple_async_result_run_in_thread</link> (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GSimpleAsyncThreadFunc">GSimpleAsyncThreadFunc</link> func,
                                                         <link linkend="int">int</link> io_priority,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-from-error">g_simple_async_result_set_from_error</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GError">GError</link> *error);
<link linkend="gboolean">gboolean</link>            <link linkend="g-simple-async-result-propagate-error">g_simple_async_result_propagate_error</link>
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GError">GError</link> **dest);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-error">g_simple_async_result_set_error</link>     (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);
<link linkend="void">void</link>                <link linkend="g-simple-async-result-set-error-va">g_simple_async_result_set_error_va</link>  (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         <link linkend="va-list">va_list</link> args);
<link linkend="void">void</link>                <link linkend="g-simple-async-report-error-in-idle">g_simple_async_report_error_in_idle</link> (<link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);
<link linkend="void">void</link>                <link linkend="g-simple-async-report-gerror-in-idle">g_simple_async_report_gerror_in_idle</link>
                                                        (<link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GError">GError</link> *error);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GSimpleAsyncResult.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GSimpleAsyncResult
</synopsis>
</refsect1>



<refsect1 id="GSimpleAsyncResult.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GSimpleAsyncResult implements
 <link linkend="GAsyncResult">GAsyncResult</link>.</para>
</refsect1>





<refsect1 id="GSimpleAsyncResult.description" role="desc">
<title role="desc.title">Description</title>
<para>
Implements <link linkend="GAsyncResult"><type>GAsyncResult</type></link> for simple cases. Most of the time, this 
will be all an application needs, and will be used transparently. 
Because of this, <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link> is used throughout GIO for 
handling asynchronous functions. 
</para>
<para>
GSimpleAsyncResult handles <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link><!-- -->s, error 
reporting, operation cancellation and the final state of an operation, 
completely transparent to the application. Results can be returned 
as a pointer e.g. for functions that return data that is collected 
asynchronously, a boolean value for checking the success or failure 
of an operation, or a <link linkend="gssize"><type>gssize</type></link> for operations which return the number 
of bytes modified by the operation; all of the simple return cases 
are covered.
</para>
<para>
Most of the time, an application will not need to know of the details 
of this API; it is handled transparently, and any necessary operations 
are handled by <link linkend="GAsyncResult"><type>GAsyncResult</type></link>'s interface. However, if implementing a 
new GIO module, for writing language bindings, or for complex 
applications that need better control of how asynchronous operations 
are completed, it is important to understand this functionality.
</para>
<para>
GSimpleAsyncResults are tagged with the calling function to ensure 
that asynchronous functions and their finishing functions are used 
together correctly.
</para>
<para>
To create a new <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>, call <link linkend="g-simple-async-result-new"><function>g_simple_async_result_new()</function></link>. 
If the result needs to be created for a <link linkend="GError"><type>GError</type></link>, use 
<link linkend="g-simple-async-result-new-from-error"><function>g_simple_async_result_new_from_error()</function></link>. If a <link linkend="GError"><type>GError</type></link> is not available 
(e.g. the asynchronous operation's doesn't take a <link linkend="GError"><type>GError</type></link> argument), 
but the result still needs to be created for an error condition, use
<link linkend="g-simple-async-result-new-error"><function>g_simple_async_result_new_error()</function></link> (or <link linkend="g-simple-async-result-set-error-va"><function>g_simple_async_result_set_error_va()</function></link>
if your application or binding requires passing a variable argument list 
directly), and the error can then be propegated through the use of 
<link linkend="g-simple-async-result-propagate-error"><function>g_simple_async_result_propagate_error()</function></link>.
</para>
<para>
An asynchronous operation can be made to ignore a cancellation event by 
calling <link linkend="g-simple-async-result-set-handle-cancellation"><function>g_simple_async_result_set_handle_cancellation()</function></link> with a 
<link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link> for the operation and <link linkend="FALSE--CAPS"><literal>FALSE</literal></link>. This is useful for
operations that are dangerous to cancel, such as close (which would
cause a leak if cancelled before being run).
</para>
<para>
GSimpleAsyncResult can integrate into GLib's event loop, <link linkend="GMainLoop"><type>GMainLoop</type></link>, 
or it can use <link linkend="GThread"><type>GThread</type></link><!-- -->s if available. 
<link linkend="g-simple-async-result-complete"><function>g_simple_async_result_complete()</function></link> will finish an I/O task directly
from the point where it is called. <link linkend="g-simple-async-result-complete-in-idle"><function>g_simple_async_result_complete_in_idle()</function></link>
will finish it from an idle handler in the <link
linkend="g-main-context-push-thread-default">thread-default main
context</link>. <link linkend="g-simple-async-result-run-in-thread"><function>g_simple_async_result_run_in_thread()</function></link> will run the
job in a separate thread and then deliver the result to the
thread-default main context.
</para>
<para>
To set the results of an asynchronous function, 
<link linkend="g-simple-async-result-set-op-res-gpointer"><function>g_simple_async_result_set_op_res_gpointer()</function></link>, 
<link linkend="g-simple-async-result-set-op-res-gboolean"><function>g_simple_async_result_set_op_res_gboolean()</function></link>, and 
<link linkend="g-simple-async-result-set-op-res-gssize"><function>g_simple_async_result_set_op_res_gssize()</function></link>
are provided, setting the operation's result to a gpointer, gboolean, or 
gssize, respectively.
</para>
<para>
Likewise, to get the result of an asynchronous function, 
<link linkend="g-simple-async-result-get-op-res-gpointer"><function>g_simple_async_result_get_op_res_gpointer()</function></link>,
<link linkend="g-simple-async-result-get-op-res-gboolean"><function>g_simple_async_result_get_op_res_gboolean()</function></link>, and 
<link linkend="g-simple-async-result-get-op-res-gssize"><function>g_simple_async_result_get_op_res_gssize()</function></link> are 
provided, getting the operation's result as a gpointer, gboolean, and 
gssize, respectively.</para>
<para>
</para>
</refsect1>

<refsect1 id="GSimpleAsyncResult.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GSimpleAsyncResult-struct" role="struct">
<title>GSimpleAsyncResult</title>
<indexterm zone="GSimpleAsyncResult-struct"><primary sortas="SimpleAsyncResult">GSimpleAsyncResult</primary></indexterm><programlisting>typedef struct _GSimpleAsyncResult GSimpleAsyncResult;</programlisting>
<para>
A simple implementation of <link linkend="GAsyncResult"><type>GAsyncResult</type></link>.</para>
<para>
</para></refsect2>
<refsect2 id="GSimpleAsyncThreadFunc" role="function">
<title>GSimpleAsyncThreadFunc ()</title>
<indexterm zone="GSimpleAsyncThreadFunc"><primary sortas="SimpleAsyncThreadFunc">GSimpleAsyncThreadFunc</primary></indexterm><programlisting><link linkend="void">void</link>                (*GSimpleAsyncThreadFunc)           (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *res,
                                                         <link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable);</programlisting>
<para>
Simple thread function that runs an asynchronous operation and
checks for cancellation.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>res</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&#160;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-new" role="function">
<title>g_simple_async_result_new ()</title>
<indexterm zone="g-simple-async-result-new"><primary sortas="simple_async_result_new">g_simple_async_result_new</primary></indexterm><programlisting><link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * g_simple_async_result_new          (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="gpointer">gpointer</link> source_tag);</programlisting>
<para>
Creates a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>source_object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link> the asynchronous function was called with,
or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>source_tag</parameter>&#160;:</term>
<listitem><simpara> the asynchronous function.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-new-error" role="function">
<title>g_simple_async_result_new_error ()</title>
<indexterm zone="g-simple-async-result-new-error"><primary sortas="simple_async_result_new_error">g_simple_async_result_new_error</primary></indexterm><programlisting><link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * g_simple_async_result_new_error    (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);</programlisting>
<para>
Creates a new <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link> with a set error.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>source_object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link>. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>domain</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQuark"><type>GQuark</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>code</parameter>&#160;:</term>
<listitem><simpara> an error code.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> a string with format characters.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara> a list of values to insert into <parameter>format</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-new-from-error" role="function">
<title>g_simple_async_result_new_from_error ()</title>
<indexterm zone="g-simple-async-result-new-from-error"><primary sortas="simple_async_result_new_from_error">g_simple_async_result_new_from_error</primary></indexterm><programlisting><link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> * g_simple_async_result_new_from_error
                                                        (<link linkend="GObject">GObject</link> *source_object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GError">GError</link> *error);</programlisting>
<para>
Creates a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link> from an error condition.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>source_object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GError"><type>GError</type></link> location.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-op-res-gpointer" role="function">
<title>g_simple_async_result_set_op_res_gpointer ()</title>
<indexterm zone="g-simple-async-result-set-op-res-gpointer"><primary sortas="simple_async_result_set_op_res_gpointer">g_simple_async_result_set_op_res_gpointer</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_op_res_gpointer
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gpointer">gpointer</link> op_res,
                                                         <link linkend="GDestroyNotify">GDestroyNotify</link> destroy_op_res);</programlisting>
<para>
Sets the operation result within the asynchronous result to a pointer.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>op_res</parameter>&#160;:</term>
<listitem><simpara> a pointer result from an asynchronous function.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>destroy_op_res</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> function.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-get-op-res-gpointer" role="function">
<title>g_simple_async_result_get_op_res_gpointer ()</title>
<indexterm zone="g-simple-async-result-get-op-res-gpointer"><primary sortas="simple_async_result_get_op_res_gpointer">g_simple_async_result_get_op_res_gpointer</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_simple_async_result_get_op_res_gpointer
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Gets a pointer result as returned by the asynchronous function.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a pointer from the result.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-op-res-gssize" role="function">
<title>g_simple_async_result_set_op_res_gssize ()</title>
<indexterm zone="g-simple-async-result-set-op-res-gssize"><primary sortas="simple_async_result_set_op_res_gssize">g_simple_async_result_set_op_res_gssize</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_op_res_gssize
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gssize">gssize</link> op_res);</programlisting>
<para>
Sets the operation result within the asynchronous result to 
the given <parameter>op_res</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>op_res</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gssize"><type>gssize</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-get-op-res-gssize" role="function">
<title>g_simple_async_result_get_op_res_gssize ()</title>
<indexterm zone="g-simple-async-result-get-op-res-gssize"><primary sortas="simple_async_result_get_op_res_gssize">g_simple_async_result_get_op_res_gssize</primary></indexterm><programlisting><link linkend="gssize">gssize</link>              g_simple_async_result_get_op_res_gssize
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Gets a gssize from the asynchronous result.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a gssize returned from the asynchronous function.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-op-res-gboolean" role="function">
<title>g_simple_async_result_set_op_res_gboolean ()</title>
<indexterm zone="g-simple-async-result-set-op-res-gboolean"><primary sortas="simple_async_result_set_op_res_gboolean">g_simple_async_result_set_op_res_gboolean</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_op_res_gboolean
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gboolean">gboolean</link> op_res);</programlisting>
<para>
Sets the operation result to a boolean within the asynchronous result.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>op_res</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gboolean"><type>gboolean</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-get-op-res-gboolean" role="function">
<title>g_simple_async_result_get_op_res_gboolean ()</title>
<indexterm zone="g-simple-async-result-get-op-res-gboolean"><primary sortas="simple_async_result_get_op_res_gboolean">g_simple_async_result_get_op_res_gboolean</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_simple_async_result_get_op_res_gboolean
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Gets the operation result boolean from within the asynchronous result.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the operation's result was <link linkend="TRUE--CAPS"><literal>TRUE</literal></link>, <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> 
    if the operation's result was <link linkend="FALSE--CAPS"><literal>FALSE</literal></link>. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-get-source-tag" role="function">
<title>g_simple_async_result_get_source_tag ()</title>
<indexterm zone="g-simple-async-result-get-source-tag"><primary sortas="simple_async_result_get_source_tag">g_simple_async_result_get_source_tag</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_simple_async_result_get_source_tag
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Gets the source tag for the <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="gpointer"><type>gpointer</type></link> to the source object for the <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-is-valid" role="function">
<title>g_simple_async_result_is_valid ()</title>
<indexterm zone="g-simple-async-result-is-valid"><primary sortas="simple_async_result_is_valid">g_simple_async_result_is_valid</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_simple_async_result_is_valid      (<link linkend="GAsyncResult">GAsyncResult</link> *result,
                                                         <link linkend="GObject">GObject</link> *source,
                                                         <link linkend="gpointer">gpointer</link> source_tag);</programlisting>
<para>
Ensures that the data passed to the _finish function of an async
operation is consistent.  Three checks are performed.
</para>
<para>
First, <parameter>result</parameter> is checked to ensure that it is really a
<link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.  Second, <parameter>source</parameter> is checked to ensure that it
matches the source object of <parameter>result</parameter>.  Third, <parameter>source_tag</parameter> is
checked to ensure that it is equal to the source_tag argument given
to <link linkend="g-simple-async-result-new"><function>g_simple_async_result_new()</function></link> (which, by convention, is a pointer
to the _async function corresponding to the _finish function from
which this function is called).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>result</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GAsyncResult"><type>GAsyncResult</type></link> passed to the _finish function.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>source</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GObject"><type>GObject</type></link> passed to the _finish function.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>source_tag</parameter>&#160;:</term>
<listitem><simpara> the asynchronous function.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><type>TRUE</type></link> if all checks passed or <link linkend="FALSE--CAPS"><type>FALSE</type></link> if any failed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-handle-cancellation" role="function">
<title>g_simple_async_result_set_handle_cancellation ()</title>
<indexterm zone="g-simple-async-result-set-handle-cancellation"><primary sortas="simple_async_result_set_handle_cancellation">g_simple_async_result_set_handle_cancellation</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_handle_cancellation
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="gboolean">gboolean</link> handle_cancellation);</programlisting>
<para>
Sets whether to handle cancellation within the asynchronous operation.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>handle_cancellation</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="gboolean"><type>gboolean</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-complete" role="function">
<title>g_simple_async_result_complete ()</title>
<indexterm zone="g-simple-async-result-complete"><primary sortas="simple_async_result_complete">g_simple_async_result_complete</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_complete      (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Completes an asynchronous I/O job immediately. Must be called in
the thread where the asynchronous result was to be delivered, as it
invokes the callback directly. If you are in a different thread use
<link linkend="g-simple-async-result-complete-in-idle"><function>g_simple_async_result_complete_in_idle()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-complete-in-idle" role="function">
<title>g_simple_async_result_complete_in_idle ()</title>
<indexterm zone="g-simple-async-result-complete-in-idle"><primary sortas="simple_async_result_complete_in_idle">g_simple_async_result_complete_in_idle</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_complete_in_idle
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple);</programlisting>
<para>
Completes an asynchronous function in an idle handler in the <link
linkend="g-main-context-push-thread-default">thread-default main
loop</link> of the thread that <parameter>simple</parameter> was initially created in.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-run-in-thread" role="function">
<title>g_simple_async_result_run_in_thread ()</title>
<indexterm zone="g-simple-async-result-run-in-thread"><primary sortas="simple_async_result_run_in_thread">g_simple_async_result_run_in_thread</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_run_in_thread (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GSimpleAsyncThreadFunc">GSimpleAsyncThreadFunc</link> func,
                                                         <link linkend="int">int</link> io_priority,
                                                         <link linkend="GCancellable">GCancellable</link> *cancellable);</programlisting>
<para>
Runs the asynchronous job in a separate thread and then calls
<link linkend="g-simple-async-result-complete-in-idle"><function>g_simple_async_result_complete_in_idle()</function></link> on <parameter>simple</parameter> to return
the result to the appropriate main loop.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>func</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncThreadFunc"><type>GSimpleAsyncThreadFunc</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>io_priority</parameter>&#160;:</term>
<listitem><simpara> the io priority of the request.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cancellable</parameter>&#160;:</term>
<listitem><simpara> optional <link linkend="GCancellable"><type>GCancellable</type></link> object, <link linkend="NULL--CAPS"><literal>NULL</literal></link> to ignore. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-from-error" role="function">
<title>g_simple_async_result_set_from_error ()</title>
<indexterm zone="g-simple-async-result-set-from-error"><primary sortas="simple_async_result_set_from_error">g_simple_async_result_set_from_error</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_from_error
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GError">GError</link> *error);</programlisting>
<para>
Sets the result from a <link linkend="GError"><type>GError</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> <link linkend="GError"><type>GError</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-propagate-error" role="function">
<title>g_simple_async_result_propagate_error ()</title>
<indexterm zone="g-simple-async-result-propagate-error"><primary sortas="simple_async_result_propagate_error">g_simple_async_result_propagate_error</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_simple_async_result_propagate_error
                                                        (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GError">GError</link> **dest);</programlisting>
<para>
Propagates an error from within the simple asynchronous result to
a given destination.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest</parameter>&#160;:</term>
<listitem><simpara> a location to propegate the error to.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the error was propegated to <parameter>dest</parameter>. <link linkend="FALSE--CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-error" role="function">
<title>g_simple_async_result_set_error ()</title>
<indexterm zone="g-simple-async-result-set-error"><primary sortas="simple_async_result_set_error">g_simple_async_result_set_error</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_error     (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);</programlisting>
<para>
Sets an error within the asynchronous result without a <link linkend="GError"><type>GError</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>domain</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQuark"><type>GQuark</type></link> (usually <link linkend="G-IO-ERROR--CAPS"><type>G_IO_ERROR</type></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>code</parameter>&#160;:</term>
<listitem><simpara> an error code.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> a formatted error reporting string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara> a list of variables to fill in <parameter>format</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-result-set-error-va" role="function">
<title>g_simple_async_result_set_error_va ()</title>
<indexterm zone="g-simple-async-result-set-error-va"><primary sortas="simple_async_result_set_error_va">g_simple_async_result_set_error_va</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_result_set_error_va  (<link linkend="GSimpleAsyncResult">GSimpleAsyncResult</link> *simple,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         <link linkend="va-list">va_list</link> args);</programlisting>
<para>
Sets an error within the asynchronous result without a <link linkend="GError"><type>GError</type></link>. 
Unless writing a binding, see <link linkend="g-simple-async-result-set-error"><function>g_simple_async_result_set_error()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>simple</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GSimpleAsyncResult"><type>GSimpleAsyncResult</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>domain</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQuark"><type>GQuark</type></link> (usually <link linkend="G-IO-ERROR--CAPS"><type>G_IO_ERROR</type></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>code</parameter>&#160;:</term>
<listitem><simpara> an error code.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> a formatted error reporting string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>args</parameter>&#160;:</term>
<listitem><simpara> va_list of arguments. 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-report-error-in-idle" role="function">
<title>g_simple_async_report_error_in_idle ()</title>
<indexterm zone="g-simple-async-report-error-in-idle"><primary sortas="simple_async_report_error_in_idle">g_simple_async_report_error_in_idle</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_report_error_in_idle (<link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GQuark">GQuark</link> domain,
                                                         <link linkend="gint">gint</link> code,
                                                         const <link linkend="char">char</link> *format,
                                                         ...);</programlisting>
<para>
Reports an error in an asynchronous function in an idle function by 
directly setting the contents of the <link linkend="GAsyncResult"><type>GAsyncResult</type></link> with the given error
information.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link>. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>domain</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQuark"><type>GQuark</type></link> containing the error domain (usually <link linkend="G-IO-ERROR--CAPS"><type>G_IO_ERROR</type></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>code</parameter>&#160;:</term>
<listitem><simpara> a specific error code.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>format</parameter>&#160;:</term>
<listitem><simpara> a formatted error reporting string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>...</parameter>&#160;:</term>
<listitem><simpara> a list of variables to fill in <parameter>format</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-simple-async-report-gerror-in-idle" role="function">
<title>g_simple_async_report_gerror_in_idle ()</title>
<indexterm zone="g-simple-async-report-gerror-in-idle"><primary sortas="simple_async_report_gerror_in_idle">g_simple_async_report_gerror_in_idle</primary></indexterm><programlisting><link linkend="void">void</link>                g_simple_async_report_gerror_in_idle
                                                        (<link linkend="GObject">GObject</link> *object,
                                                         <link linkend="GAsyncReadyCallback">GAsyncReadyCallback</link> callback,
                                                         <link linkend="gpointer">gpointer</link> user_data,
                                                         <link linkend="GError">GError</link> *error);</programlisting>
<para>
Reports an error in an idle function. Similar to 
<link linkend="g-simple-async-report-error-in-idle"><function>g_simple_async_report_error_in_idle()</function></link>, but takes a <link linkend="GError"><type>GError</type></link> rather 
than building a new one.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>object</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GObject"><type>GObject</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GAsyncReadyCallback"><type>GAsyncReadyCallback</type></link>. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GError"><type>GError</type></link> to report
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>



<refsect1 id="GSimpleAsyncResult.see-also">
<title>See Also</title>
#GAsyncResult
</refsect1>

</refentry>
