1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GIOScheduler</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
<link rel="start" href="index.html" title="GIO Reference Manual">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
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="GAsyncResult.html" title="GAsyncResult">
10
10
<link rel="next" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult">
11
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
13
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
14
14
<link rel="chapter" href="ch01.html" title="Introduction">
15
15
<link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16
16
<link rel="chapter" href="ch03.html" title="Running GIO applications">
17
<link rel="chapter" href="gio-extension-points.html" title="Extending GIO">
18
<link rel="part" href="pt02.html" title="Part II. API Reference">
17
<link rel="chapter" href="extending-gio.html" title="Extending GIO">
18
<link rel="part" href="pt02.html" title="Part II. API Reference">
19
19
<link rel="chapter" href="file_ops.html" title="File Operations">
20
20
<link rel="chapter" href="file_mon.html" title="File System Monitoring">
21
21
<link rel="chapter" href="async.html" title="Asynchronous I/O">
25
25
<link rel="chapter" href="icons.html" title="Icons">
26
26
<link rel="chapter" href="utils.html" title="Utilities">
27
27
<link rel="chapter" href="extending.html" title="Extending GIO">
28
<link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
28
<link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
29
29
<link rel="chapter" href="ch14.html" title="Migrating from POSIX to GIO">
30
30
<link rel="chapter" href="ch15.html" title="Migrating from GnomeVFS to GIO">
31
31
<link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
32
32
<link rel="index" href="ix01.html" title="Index">
33
<link rel="index" href="ix02.html" title="Index of new symbols in 2.18">
34
35
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
35
36
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
40
41
<th width="100%" align="center">GIO Reference Manual</th>
41
42
<td><a accesskey="n" href="GSimpleAsyncResult.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
43
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2785534" class="shortcut">Top</a>
45
<a href="#id2750728" class="shortcut">Description</a></nobr></td></tr>
44
<tr><td colspan="5" class="shortcuts">
45
<a href="#gio-GIOScheduler.synopsis" class="shortcut">Top</a>
47
<a href="#gio-GIOScheduler.description" class="shortcut">Description</a>
47
50
<div class="refentry" lang="en">
48
51
<a name="gio-GIOScheduler"></a><div class="titlepage"></div>
49
52
<div class="refnamediv"><table width="100%"><tr>
52
<a name="id2785534"></a><span class="refentrytitle">GIOScheduler</span>
54
<p>GIOScheduler — I/O Scheduler</p>
54
<h2><span class="refentrytitle"><a name="gio-GIOScheduler.top_of_page"></a>GIOScheduler</span></h2>
55
<p>GIOScheduler — I/O Scheduler</p>
56
57
<td valign="top" align="right"></td>
57
58
</tr></table></div>
58
59
<div class="refsynopsisdiv">
60
<a name="gio-GIOScheduler.synopsis"></a><h2>Synopsis</h2>
60
61
<pre class="synopsis">
62
63
#include <gio/gio.h>
65
<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a>;
65
<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a>;
67
67
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
68
>gboolean</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc">*GIOSchedulerJobFunc</a>) (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,
68
>gboolean</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc" title="GIOSchedulerJobFunc ()">*GIOSchedulerJobFunc</a>) (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
69
69
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
71
71
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
72
72
>gpointer</a> user_data);
73
void <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job">g_io_scheduler_push_job</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc">GIOSchedulerJobFunc</a> job_func,
73
void <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job" title="g_io_scheduler_push_job ()">g_io_scheduler_push_job</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc" title="GIOSchedulerJobFunc ()">GIOSchedulerJobFunc</a> job_func,
75
75
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
76
76
>gpointer</a> user_data,
121
<p><a name="io-priority"></a><a class="indexterm" name="id2750764"></a>
121
<p><a name="io-priority"></a>
122
122
Each I/O operation has a priority, and the scheduler uses the priorities
123
123
to determine the order in which operations are executed. They are
124
124
<span class="emphasis"><em>not</em></span> used to determine system-wide I/O scheduling.
125
125
Priorities are integers, with lower numbers indicating higher priority.
126
126
It is recommended to choose priorities between <a
127
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-LOW:CAPS"
127
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-LOW--CAPS"
128
128
><code class="literal">G_PRIORITY_LOW</code></a> and
130
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH:CAPS"
130
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH--CAPS"
131
131
><code class="literal">G_PRIORITY_HIGH</code></a>, with <a
132
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT:CAPS"
132
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT--CAPS"
133
133
><code class="literal">G_PRIORITY_DEFAULT</code></a> as a default.
139
138
<div class="refsect1" lang="en">
140
<a name="id2750814"></a><h2>Details</h2>
139
<a name="gio-GIOScheduler.details"></a><h2>Details</h2>
141
140
<div class="refsect2" lang="en">
142
<a name="id2750824"></a><h3>
143
<a name="GIOSchedulerJob"></a>GIOSchedulerJob</h3>
144
<a class="indexterm" name="id2750837"></a><pre class="programlisting">typedef struct _GIOSchedulerJob GIOSchedulerJob;</pre>
141
<a name="GIOSchedulerJob"></a><h3>GIOSchedulerJob</h3>
142
<pre class="programlisting">typedef struct _GIOSchedulerJob GIOSchedulerJob;</pre>
146
144
Opaque class for definining and scheduling IO jobs.</p>
152
149
<div class="refsect2" lang="en">
153
<a name="id2750858"></a><h3>
154
<a name="GIOSchedulerJobFunc"></a>GIOSchedulerJobFunc ()</h3>
155
<a class="indexterm" name="id2750870"></a><pre class="programlisting"><a
150
<a name="GIOSchedulerJobFunc"></a><h3>GIOSchedulerJobFunc ()</h3>
151
<pre class="programlisting"><a
156
152
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
157
>gboolean</a> (*GIOSchedulerJobFunc) (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,
153
>gboolean</a> (*GIOSchedulerJobFunc) (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
158
154
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
160
156
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
161
157
>gpointer</a> user_data);</pre>
166
Note that depending on whether threads are available, the
167
<span class="type">GIOScheduler</span> may run jobs in separate threads or in an idle
162
Note that depending on whether threads are available, the
163
<span class="type">GIOScheduler</span> may run jobs in separate threads or in an idle
171
167
Long-running jobs should periodically check the <em class="parameter"><code>cancellable</code></em>
172
168
to see if they have been cancelled.</p>
176
171
<div class="variablelist"><table border="0">
177
172
<col align="left" valign="top">
180
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
181
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>.
175
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
176
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>.
185
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
180
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
186
181
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
187
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
182
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
188
183
><code class="literal">NULL</code></a> to ignore.
192
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
187
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
193
188
<td> the data to pass to callback function
197
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
192
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
199
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
194
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE--CAPS"
200
195
><code class="literal">TRUE</code></a> if this function should be called again to
201
196
complete the job, <a
202
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"
197
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE--CAPS"
203
198
><code class="literal">FALSE</code></a> if the job is complete (or cancelled)
232
226
If <em class="parameter"><code>cancellable</code></em> is not <a
233
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
227
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
234
228
><code class="literal">NULL</code></a>, it can be used to cancel the I/O job
235
by calling <a class="link" href="GCancellable.html#g-cancellable-cancel"><code class="function">g_cancellable_cancel()</code></a> or by calling
236
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-cancel-all-jobs"><code class="function">g_io_scheduler_cancel_all_jobs()</code></a>.</p>
229
by calling <a class="link" href="GCancellable.html#g-cancellable-cancel" title="g_cancellable_cancel ()"><code class="function">g_cancellable_cancel()</code></a> or by calling
230
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-cancel-all-jobs" title="g_io_scheduler_cancel_all_jobs ()"><code class="function">g_io_scheduler_cancel_all_jobs()</code></a>.</p>
240
233
<div class="variablelist"><table border="0">
241
234
<col align="left" valign="top">
244
<td><p><span class="term"><em class="parameter"><code>job_func</code></em> :</span></p></td>
245
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc"><span class="type">GIOSchedulerJobFunc</span></a>.
237
<td><p><span class="term"><em class="parameter"><code>job_func</code></em> :</span></p></td>
238
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc" title="GIOSchedulerJobFunc ()"><span class="type">GIOSchedulerJobFunc</span></a>.
249
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
242
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
250
243
<td> data to pass to <em class="parameter"><code>job_func</code></em>
254
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
247
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
256
249
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
257
250
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
258
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
251
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
259
252
><code class="literal">NULL</code></a>
263
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
256
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
264
257
<td> the I/O priority
269
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
262
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
270
263
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
271
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
264
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
272
265
><code class="literal">NULL</code></a> to ignore.
279
272
<div class="refsect2" lang="en">
280
<a name="id2800522"></a><h3>
281
<a name="g-io-scheduler-cancel-all-jobs"></a>g_io_scheduler_cancel_all_jobs ()</h3>
282
<a class="indexterm" name="id2800533"></a><pre class="programlisting">void g_io_scheduler_cancel_all_jobs (void);</pre>
273
<a name="g-io-scheduler-cancel-all-jobs"></a><h3>g_io_scheduler_cancel_all_jobs ()</h3>
274
<pre class="programlisting">void g_io_scheduler_cancel_all_jobs (void);</pre>
284
276
Cancels all cancellable I/O jobs.
287
279
A job is cancellable if a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> was passed into
288
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job"><code class="function">g_io_scheduler_push_job()</code></a>.</p>
280
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job" title="g_io_scheduler_push_job ()"><code class="function">g_io_scheduler_push_job()</code></a>.</p>
294
285
<div class="refsect2" lang="en">
295
<a name="id2800577"></a><h3>
296
<a name="g-io-scheduler-job-send-to-mainloop"></a>g_io_scheduler_job_send_to_mainloop ()</h3>
297
<a class="indexterm" name="id2748793"></a><pre class="programlisting"><a
286
<a name="g-io-scheduler-job-send-to-mainloop"></a><h3>g_io_scheduler_job_send_to_mainloop ()</h3>
287
<pre class="programlisting"><a
298
288
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
299
>gboolean</a> g_io_scheduler_job_send_to_mainloop (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,
289
>gboolean</a> g_io_scheduler_job_send_to_mainloop (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
301
291
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#GSourceFunc"
302
292
>GSourceFunc</a> func,
311
301
main loop (main thread), waiting for the result (and thus
312
302
blocking the I/O job).</p>
316
305
<div class="variablelist"><table border="0">
317
306
<col align="left" valign="top">
320
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
321
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
309
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
310
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
325
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
314
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
327
316
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#GSourceFunc"
328
317
><span class="type">GSourceFunc</span></a> callback that will be called in the main thread
332
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
321
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
333
322
<td> data to pass to <em class="parameter"><code>func</code></em>
337
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
326
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
339
328
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
340
329
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
341
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
330
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
342
331
><code class="literal">NULL</code></a>
346
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
335
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
347
336
<td> The return value of <em class="parameter"><code>func</code></em>
372
360
finished. The return value from the callback is ignored.
375
Note that if you are passing the <em class="parameter"><code>user_data</code></em> from <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job"><code class="function">g_io_scheduler_push_job()</code></a>
363
Note that if you are passing the <em class="parameter"><code>user_data</code></em> from <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job" title="g_io_scheduler_push_job ()"><code class="function">g_io_scheduler_push_job()</code></a>
376
364
on to this function you have to ensure that it is not freed before
377
365
<em class="parameter"><code>func</code></em> is called, either by passing <a
378
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
366
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
379
367
><code class="literal">NULL</code></a> as <em class="parameter"><code>notify</code></em> to
380
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job"><code class="function">g_io_scheduler_push_job()</code></a> or by using refcounting for <em class="parameter"><code>user_data</code></em>.</p>
368
<a class="link" href="gio-GIOScheduler.html#g-io-scheduler-push-job" title="g_io_scheduler_push_job ()"><code class="function">g_io_scheduler_push_job()</code></a> or by using refcounting for <em class="parameter"><code>user_data</code></em>.</p>
384
371
<div class="variablelist"><table border="0">
385
372
<col align="left" valign="top">
388
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
389
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
375
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
376
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
393
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
380
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
395
382
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#GSourceFunc"
396
383
><span class="type">GSourceFunc</span></a> callback that will be called in the main thread
400
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
387
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
401
388
<td> data to pass to <em class="parameter"><code>func</code></em>
405
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
392
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
407
394
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
408
395
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
409
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"
396
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL--CAPS"
410
397
><code class="literal">NULL</code></a>