| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/gtk-doc/html/gio/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GIOScheduler</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="async.html" title="Asynchronous I/O">
<link rel="prev" href="GAsyncResult.html" title="GAsyncResult">
<link rel="next" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
<link rel="chapter" href="ch01.html" title="Introduction">
<link rel="chapter" href="ch02.html" title="Compiling GIO applications">
<link rel="chapter" href="ch03.html" title="Running GIO applications">
<link rel="chapter" href="extending-gio.html" title="Extending GIO">
<link rel="part" href="pt02.html" title="Part II. API Reference">
<link rel="chapter" href="file_ops.html" title="File Operations">
<link rel="chapter" href="file_mon.html" title="File System Monitoring">
<link rel="chapter" href="async.html" title="Asynchronous I/O">
<link rel="chapter" href="streaming.html" title="Streaming I/O">
<link rel="chapter" href="types.html" title="File types and applications">
<link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
<link rel="chapter" href="icons.html" title="Icons">
<link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
<link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
<link rel="chapter" href="resolver.html" title="DNS resolution">
<link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
<link rel="chapter" href="utils.html" title="Utilities">
<link rel="chapter" href="extending.html" title="Extending GIO">
<link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
<link rel="chapter" href="ch18.html" title="Migrating from POSIX to GIO">
<link rel="chapter" href="ch19.html" title="Migrating from GnomeVFS to GIO">
<link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.18">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.20">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.22">
</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="2">
<tr valign="middle">
<td><a accesskey="p" href="GAsyncResult.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="async.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GSimpleAsyncResult.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gio-GIOScheduler.synopsis" class="shortcut">Top</a>
|
<a href="#gio-GIOScheduler.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="GIOScheduler">
<a name="gio-GIOScheduler"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gio-GIOScheduler.top_of_page"></a>GIOScheduler</span></h2>
<p>GIOScheduler — I/O Scheduler</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="gio-GIOScheduler.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <gio/gio.h>
<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a>;
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>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,
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);
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,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> io_priority,
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable);
void <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-cancel-all-jobs" title="g_io_scheduler_cancel_all_jobs ()">g_io_scheduler_cancel_all_jobs</a> (void);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-job-send-to-mainloop" title="g_io_scheduler_job_send_to_mainloop ()">g_io_scheduler_job_send_to_mainloop</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
>GSourceFunc</a> func,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify);
void <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-job-send-to-mainloop-async" title="g_io_scheduler_job_send_to_mainloop_async ()">g_io_scheduler_job_send_to_mainloop_async</a>
(<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
>GSourceFunc</a> func,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="gio-GIOScheduler.description"></a><h2>Description</h2>
<p>
Schedules asynchronous I/O operations. <span class="type">GIOScheduler</span> integrates
into the main event loop (<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GMainLoop"
><span class="type">GMainLoop</span></a>) and may use threads if they
are available.
</p>
<p>
</p>
<p><a name="io-priority"></a>
Each I/O operation has a priority, and the scheduler uses the priorities
to determine the order in which operations are executed. They are
<span class="emphasis"><em>not</em></span> used to determine system-wide I/O scheduling.
Priorities are integers, with lower numbers indicating higher priority.
It is recommended to choose priorities between <a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#G-PRIORITY-LOW--CAPS"
><code class="literal">G_PRIORITY_LOW</code></a> and
<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH--CAPS"
><code class="literal">G_PRIORITY_HIGH</code></a>, with <a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#G-PRIORITY-DEFAULT--CAPS"
><code class="literal">G_PRIORITY_DEFAULT</code></a> as a default.
</p>
<p>
</p>
</div>
<div class="refsect1" title="Details">
<a name="gio-GIOScheduler.details"></a><h2>Details</h2>
<div class="refsect2" title="GIOSchedulerJob">
<a name="GIOSchedulerJob"></a><h3>GIOSchedulerJob</h3>
<pre class="programlisting">typedef struct _GIOSchedulerJob GIOSchedulerJob;</pre>
<p>
Opaque class for definining and scheduling IO jobs.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="GIOSchedulerJobFunc ()">
<a name="GIOSchedulerJobFunc"></a><h3>GIOSchedulerJobFunc ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> (*GIOSchedulerJobFunc) (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data);</pre>
<p>
I/O Job function.
</p>
<p>
Note that depending on whether threads are available, the
<span class="type">GIOScheduler</span> may run jobs in separate threads or in an idle
in the mainloop.
</p>
<p>
Long-running jobs should periodically check the <em class="parameter"><code>cancellable</code></em>
to see if they have been cancelled.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> to ignore.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> the data to pass to callback function
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
><code class="literal">TRUE</code></a> if this function should be called again to
complete the job, <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
><code class="literal">FALSE</code></a> if the job is complete (or cancelled)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_io_scheduler_push_job ()">
<a name="g-io-scheduler-push-job"></a><h3>g_io_scheduler_push_job ()</h3>
<pre class="programlisting">void g_io_scheduler_push_job (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc" title="GIOSchedulerJobFunc ()">GIOSchedulerJobFunc</a> job_func,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
>gint</a> io_priority,
<a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable);</pre>
<p>
Schedules the I/O job to run.
</p>
<p>
<em class="parameter"><code>notify</code></em> will be called on <em class="parameter"><code>user_data</code></em> after <em class="parameter"><code>job_func</code></em> has returned,
regardless whether the job was cancelled or has run to completion.
</p>
<p>
If <em class="parameter"><code>cancellable</code></em> is not <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>, it can be used to cancel the I/O job
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
<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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>job_func</code></em> :</span></p></td>
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc" title="GIOSchedulerJobFunc ()"><span class="type">GIOSchedulerJobFunc</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> data to pass to <em class="parameter"><code>job_func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
<td> a <a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
<td> the I/O priority
of the request.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> to ignore.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_io_scheduler_cancel_all_jobs ()">
<a name="g-io-scheduler-cancel-all-jobs"></a><h3>g_io_scheduler_cancel_all_jobs ()</h3>
<pre class="programlisting">void g_io_scheduler_cancel_all_jobs (void);</pre>
<p>
Cancels all cancellable I/O jobs.
</p>
<p>
A job is cancellable if a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> was passed into
<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>
<p>
</p>
</div>
<hr>
<div class="refsect2" title="g_io_scheduler_job_send_to_mainloop ()">
<a name="g-io-scheduler-job-send-to-mainloop"></a><h3>g_io_scheduler_job_send_to_mainloop ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> g_io_scheduler_job_send_to_mainloop (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
>GSourceFunc</a> func,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify);</pre>
<p>
Used from an I/O job to send a callback to be run in the thread
that the job was started from, waiting for the result (and thus
blocking the I/O job).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
<td> a <a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
><span class="type">GSourceFunc</span></a> callback that will be called in the original thread
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> data to pass to <em class="parameter"><code>func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
<td> a <a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The return value of <em class="parameter"><code>func</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="g_io_scheduler_job_send_to_mainloop_async ()">
<a name="g-io-scheduler-job-send-to-mainloop-async"></a><h3>g_io_scheduler_job_send_to_mainloop_async ()</h3>
<pre class="programlisting">void g_io_scheduler_job_send_to_mainloop_async
(<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob">GIOSchedulerJob</a> *job,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
>GSourceFunc</a> func,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> notify);</pre>
<p>
Used from an I/O job to send a callback to be run asynchronously in
the thread that the job was started from. The callback will be run
when the main loop is available, but at that time the I/O job might
have finished. The return value from the callback is ignored.
</p>
<p>
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>
on to this function you have to ensure that it is not freed before
<em class="parameter"><code>func</code></em> is called, either by passing <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a> as <em class="parameter"><code>notify</code></em> to
<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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>job</code></em> :</span></p></td>
<td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob" title="GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
<td> a <a
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GSourceFunc"
><span class="type">GSourceFunc</span></a> callback that will be called in the original thread
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> data to pass to <em class="parameter"><code>func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>notify</code></em> :</span></p></td>
<td> a <a
href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"
><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>, or <a
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL--CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>