Imported Upstream version 2.28.6
[platform/upstream/pygobject2.git] / docs / html / class-gioasyncresult.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gio.AsyncResult</title><link rel="stylesheet" type="text/css" href="style.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="PyGObject Reference Manual"><link rel="up" href="gio-class-reference.html" title="PyGio Class Reference"><link rel="prev" href="class-gioapplaunchcontext.html" title="gio.AppLaunchContext"><link rel="next" href="class-giobufferedinputstream.html" title="gio.BufferedInputStream"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gio.AsyncResult</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gioapplaunchcontext.html">Prev</a> </td><th width="60%" align="center">PyGio Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-giobufferedinputstream.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gio.AsyncResult"><a name="class-gioasyncresult"></a><div class="titlepage"></div><div class="refnamediv"><h2>gio.AsyncResult</h2><p>gio.AsyncResult — Asynchronous Function Results.</p></div><div class="refsect1" title="Synopsis"><a name="id504044"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gio.AsyncResult</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a></span></span>):
2 <code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gioasyncresult.html#method-gioasyncresult--get-source-object" title="gio.AsyncResult.get_source_object">get_source_object</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id504001"></a><h2>Ancestry</h2><pre class="synopsis">+-- <a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a>
3   +-- <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult">gio.AsyncResult</a>
4 </pre></div><div class="refsect1" title="Prerequisites"><a name="id503975"></a><h2>Prerequisites</h2><p>
5             <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a> is required by
6             <a class="link" href="class-gobject.html" title="gobject.GObject"><code class="classname">gobject.GObject</code></a>.
7         </p></div><div class="refsect1" title="Known Implementation"><a name="id503938"></a><h2>Known Implementation</h2><p>
8             <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a> is implemented by
9             <a class="link" href="class-giosimpleasyncresult.html" title="gio.SimpleAsyncResult"><code class="classname">gio.SimpleAsyncResult</code></a>.
10         </p></div><div class="refsect1" title="Description"><a name="id440594"></a><h2>Description</h2><p>
11             <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
12             provides a base class for implementing asynchronous function results.
13         </p><p>
14             Asynchronous operations are broken up into two separate operations which are chained
15             together by a GAsyncReadyCallback. To begin an asynchronous operation, provide a
16             GAsyncReadyCallback to the asynchronous function. This callback will be triggered when
17             the operation has completed, and will be passed a GAsyncResult instance filled with the
18             details of the operation's success or failure, the object the asynchronous function was
19             started for and any error codes returned. The asynchronous callback function is then expected
20             to call the corresponding "_finish()" function with the object the function was called for,
21             and the <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
22             instance, and optionally, an error to grab any error conditions that may have occurred. 
23         </p><p>
24             The purpose of the "_finish()" function is to take the generic result of type GAsyncResult and
25             return the specific result that the operation in question yields (e.g. a
26             <a class="link" href="class-giofileenumerator.html" title="gio.FileEnumerator"><code class="classname">gio.FileEnumerator</code></a>
27             for a "enumerate children" operation). If the result or error status of the operation is not needed,
28             there is no need to call the "_finish()" function, GIO will take care of cleaning up the result and error
29             information after the GAsyncReadyCallback returns. It is also allowed to take a reference to the
30             <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
31             and call "_finish()" later. 
32         </p><p>
33             The callback for an asynchronous operation is called only once, and is always called, even
34             in the case of a cancelled operation. On cancellation the result is a gio.ERROR_CANCELLED error. 
35         </p><p>
36             Some ascynchronous operations are implemented using synchronous calls. These are run in a
37             separate thread, if GThread has been initialized, but otherwise they are sent to the Main Event
38             Loop and processed in an idle function. So, if you truly need asynchronous operations, make
39             sure to initialize GThread.
40         </p></div><div class="refsect1" title="Methods"><a name="id437501"></a><h2>Methods</h2><div class="refsect2" title="gio.AsyncResult.get_source_object"><a name="method-gioasyncresult--get-source-object"></a><h3>gio.AsyncResult.get_source_object</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_source_object</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the source object for the res.                        
41                     </td></tr></tbody></table><p>
42                 The <code class="methodname">get_source_object</code>() method gets the source object
43                 from a <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>
44             </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gioapplaunchcontext.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gio-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-giobufferedinputstream.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gio.AppLaunchContext </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gio.BufferedInputStream</td></tr></table></div></body></html>