gio-gioscheduler.html

来自「最新gtk中文资料集」· HTML 代码 · 共 425 行 · 第 1/2 页

HTML
425
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>GIOScheduler</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" 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.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="Part&#160;I.&#160;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="gio-extension-points.html" title="Extending GIO"><link rel="part" href="pt02.html" title="Part&#160;II.&#160;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="utils.html" title="Utilities"><link rel="chapter" href="extending.html" title="Extending GIO"><link rel="part" href="migrating.html" title="Part&#160;III.&#160;Migrating to GIO"><link rel="chapter" href="ch14.html" title="Migrating from POSIX to GIO"><link rel="chapter" href="ch15.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"></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"><nobr><a href="#id3112376" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id3104312" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="gio-GIOScheduler"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3112376"></a><span class="refentrytitle">GIOScheduler</span></h2><p>GIOScheduler &#8212; I/O Scheduler</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;gio/gio.h&gt;                    <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a>;<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>            (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc">*GIOSchedulerJobFunc</a>)              (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,                                                         <a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);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,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify,                                                         <ahref="/usr/share/gtk-doc/html/glib/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">g_io_scheduler_cancel_all_jobs</a>      (void);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="gio-GIOScheduler.html#g-io-scheduler-job-send-to-mainloop">g_io_scheduler_job_send_to_mainloop</a> (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> func,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);void                <a class="link" href="gio-GIOScheduler.html#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">GIOSchedulerJob</a> *job,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#GSourceFunc">GSourceFunc</a> func,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);</pre></div><div class="refsect1" lang="en"><a name="id3104312"></a><h2>Description</h2><p>Schedules asynchronous I/O operations. <span class="type">GIOScheduler</span> integrates into the main event loop (<ahref="/usr/share/gtk-doc/html/glib/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><a class="indexterm" name="id3104347"></a>Each I/O operation has a priority, and the scheduler uses the prioritiesto 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 <ahref="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-LOW:CAPS"><code class="literal">G_PRIORITY_LOW</code></a> and <ahref="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html#G-PRIORITY-HIGH:CAPS"><code class="literal">G_PRIORITY_HIGH</code></a>, with <ahref="/usr/share/gtk-doc/html/glib/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" lang="en"><a name="id3136118"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3136129"></a><h3><a name="GIOSchedulerJob"></a>GIOSchedulerJob</h3><a class="indexterm" name="id3136141"></a><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" lang="en"><a name="id3136162"></a><h3><a name="GIOSchedulerJobFunc"></a>GIOSchedulerJobFunc ()</h3><a class="indexterm" name="id3136174"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>            (*GIOSchedulerJobFunc)              (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob">GIOSchedulerJob</a> *job,                                                         <a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable,                                                         <ahref="/usr/share/gtk-doc/html/glib/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>&#160;:</span></p></td><td> a <a class="link" href="gio-GIOScheduler.html#GIOSchedulerJob"><span class="type">GIOSchedulerJob</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>cancellable</code></em>&#160;:</span></p></td><td> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.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>&#160;:</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>&#160;:</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if this function should be called again to   complete the job, <ahref="/usr/share/gtk-doc/html/glib/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" lang="en"><a name="id3136344"></a><h3><a name="g-io-scheduler-push-job"></a>g_io_scheduler_push_job ()</h3><a class="indexterm" name="id3136355"></a><pre class="programlisting">void                g_io_scheduler_push_job             (<a class="link" href="gio-GIOScheduler.html#GIOSchedulerJobFunc">GIOSchedulerJobFunc</a> job_func,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?