/usr/share/gtk-doc/html/libinfinity-0.6/libinfinity-0.6-InfAsyncOperation.html is in libinfinity-0.6-doc 0.6.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>InfAsyncOperation: libinfinity-0.6 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="libinfinity-0.6 Reference Manual">
<link rel="up" href="ch02.html" title="Common libinfinity API">
<link rel="prev" href="InfStandaloneIo.html" title="InfStandaloneIo">
<link rel="next" href="InfCertificateChain.html" title="InfCertificateChain">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#libinfinity-0.6-InfAsyncOperation.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="InfStandaloneIo.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="InfCertificateChain.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libinfinity-0.6-InfAsyncOperation"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libinfinity-0.6-InfAsyncOperation.top_of_page"></a>InfAsyncOperation</span></h2>
<p>InfAsyncOperation — Perform long-running operations in a separate thread</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.stability-level"></a><h2>Stability Level</h2>
<a href="http://foldoc.org/Unstable"><span class="acronym">Unstable</span></a>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperationRunFunc" title="InfAsyncOperationRunFunc ()">*InfAsyncOperationRunFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperationDoneFunc" title="InfAsyncOperationDoneFunc ()">*InfAsyncOperationDoneFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="returnvalue">InfAsyncOperation</span></a> *
</td>
<td class="function_name">
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-new" title="inf_async_operation_new ()">inf_async_operation_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-start" title="inf_async_operation_start ()">inf_async_operation_start</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-free" title="inf_async_operation_free ()">inf_async_operation_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation">InfAsyncOperation</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include <libinfinity/inf-async-operation.h>
</pre>
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.description"></a><h2>Description</h2>
<p><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a> is a simple mechanism to run some code in a separate
worker thread and then, once the result is computed, notify the main thread
about the result.</p>
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="InfAsyncOperationRunFunc"></a><h3>InfAsyncOperationRunFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
<span class="c_punctuation">(</span>*InfAsyncOperationRunFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><span class="type">gpointer</span> *run_data</code></em>,
<em class="parameter"><code><span class="type">GDestroyNotify</span> *run_notify</code></em>,
<em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
<p>This function performs the asynchronous task and is executed in a separate
thread. The pointer written into <em class="parameter"><code>run_data</code></em>
is passed back to the main
thread after the function has finished executing.</p>
<div class="refsect3">
<a name="id-1.3.26.8.2.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>run_data</p></td>
<td class="parameter_description"><p>Location where to write the result of the asynchronous
operation.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>run_notify</p></td>
<td class="parameter_description"><p>Function to be used to free <em class="parameter"><code>run_data</code></em>
, or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>Data passed in <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-new" title="inf_async_operation_new ()"><code class="function">inf_async_operation_new()</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="InfAsyncOperationDoneFunc"></a><h3>InfAsyncOperationDoneFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
<span class="c_punctuation">(</span>*InfAsyncOperationDoneFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><span class="type">gpointer</span> run_data</code></em>,
<em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
<p>This function is called in the main thread once the asynchronous operation
has finished.</p>
<div class="refsect3">
<a name="id-1.3.26.8.3.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>run_data</p></td>
<td class="parameter_description"><p>The result of the asynchronous operation.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>Data passed in <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-new" title="inf_async_operation_new ()"><code class="function">inf_async_operation_new()</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="inf-async-operation-new"></a><h3>inf_async_operation_new ()</h3>
<pre class="programlisting"><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="returnvalue">InfAsyncOperation</span></a> *
inf_async_operation_new (<em class="parameter"><code><a class="link" href="InfIo.html" title="InfIo"><span class="type">InfIo</span></a> *io</code></em>,
<em class="parameter"><code><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperationRunFunc" title="InfAsyncOperationRunFunc ()"><span class="type">InfAsyncOperationRunFunc</span></a> run_func</code></em>,
<em class="parameter"><code><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperationDoneFunc" title="InfAsyncOperationDoneFunc ()"><span class="type">InfAsyncOperationDoneFunc</span></a> done_func</code></em>,
<em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
<p>This function creates a new <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a>. The function given by
<em class="parameter"><code>run_func</code></em>
will be run asynchronously in a worker thread. Once the function
finishes, its result is passed back to the main thread defined by <em class="parameter"><code>io</code></em>
, and
<em class="parameter"><code>done_func</code></em>
is called with the computed result in the main thread.</p>
<p>To actually start the asynchronous operation, call
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-start" title="inf_async_operation_start ()"><code class="function">inf_async_operation_start()</code></a>. This allows to save the returned value into
a structure before starting the operation, avoiding a potential race
condition if the asynchronous function finishes quickly.</p>
<p>The asynchronous operation can be canceled by calling
<a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-free" title="inf_async_operation_free ()"><code class="function">inf_async_operation_free()</code></a> on the returned <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a> object.
If the operation is not cancelled and after <em class="parameter"><code>done_func</code></em>
has been called,
the operation is freed automatically and must not be freed by the caller.
The caller must also keep a reference to <em class="parameter"><code>io</code></em>
while the operation is
running. Before dropping your reference to <em class="parameter"><code>io</code></em>
, make sure to free the
asynchronous operation. When the last reference to <em class="parameter"><code>io</code></em>
is dropped, the
operation is freed automatically, since it cannot pass back its result to
the main thread anymore.</p>
<div class="refsect3">
<a name="id-1.3.26.8.4.7"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>io</p></td>
<td class="parameter_description"><p>The <a class="link" href="InfIo.html" title="InfIo"><span class="type">InfIo</span></a> object used to pass back the result of the operation.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>run_func</p></td>
<td class="parameter_description"><p>A function to run asynchronously in a worker thread, computing
the result of the operation.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>done_func</p></td>
<td class="parameter_description"><p>A function to be called in the thread of <em class="parameter"><code>io</code></em>
once the result
is available.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>Additional user data to pass to both functions.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.26.8.4.8"></a><h4>Returns</h4>
<p> A new <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a>. Free with <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-free" title="inf_async_operation_free ()"><code class="function">inf_async_operation_free()</code></a> to
cancel the operation.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="inf-async-operation-start"></a><h3>inf_async_operation_start ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
inf_async_operation_start (<em class="parameter"><code><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a> *op</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Starts the operation given in <em class="parameter"><code>op</code></em>
. The operation must have been created
before with <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#inf-async-operation-new" title="inf_async_operation_new ()"><code class="function">inf_async_operation_new()</code></a>. If the operation cannot be started,
<em class="parameter"><code>error</code></em>
is set and <code class="literal">FALSE</code> is returned. In that case, the operation must not
be used anymore since it will be automatically freed.</p>
<div class="refsect3">
<a name="id-1.3.26.8.5.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>op</p></td>
<td class="parameter_description"><p>A <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Location to store error information, if any.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.26.8.5.6"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> on success or <code class="literal">FALSE</code> if the operation could not be started.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="inf-async-operation-free"></a><h3>inf_async_operation_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
inf_async_operation_free (<em class="parameter"><code><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a> *op</code></em>);</pre>
<p>Frees the given asynchronous operation and cancels it if it is currently
running. This should only be called to cancel a running operation, or to
free an operation that has not been started. In all other cases, the
operation is freed automatically.</p>
<div class="refsect3">
<a name="id-1.3.26.8.6.5"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>op</p></td>
<td class="parameter_description"><p>A <a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="libinfinity-0.6-InfAsyncOperation.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="InfAsyncOperation"></a><h3>InfAsyncOperation</h3>
<pre class="programlisting">typedef struct _InfAsyncOperation InfAsyncOperation;</pre>
<p><a class="link" href="libinfinity-0.6-InfAsyncOperation.html#InfAsyncOperation" title="InfAsyncOperation"><span class="type">InfAsyncOperation</span></a> is an opaque data type and should only be accessed via
the public API functions.</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>
|