1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Queuing</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Hacking The Linux Kernel"><link rel="up" href="queues.html" title="Chapter&#160;7.&#160;Wait Queues include/linux/wait.h"><link rel="prev" href="queues.html" title="Chapter&#160;7.&#160;Wait Queues include/linux/wait.h"><link rel="next" href="queue-waking.html" title="Waking Up Queued Tasks"></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">Queuing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="queues.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;7.&#160;Wait Queues
2   <code class="filename">include/linux/wait.h</code>
3  </th><td width="20%" align="right">&#160;<a accesskey="n" href="queue-waking.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="queue-waitqueue"></a>Queuing</h2></div></div></div><p>
4    Placing yourself in the waitqueue is fairly complex, because you
5    must put yourself in the queue before checking the condition.
6    There is a macro to do this:
7    <code class="function">wait_event_interruptible()</code>
8
9    <code class="filename">include/linux/wait.h</code> The
10    first argument is the wait queue head, and the second is an
11    expression which is evaluated; the macro returns
12    <span class="returnvalue">0</span> when this expression is true, or
13    <span class="returnvalue">-ERESTARTSYS</span> if a signal is received.
14    The <code class="function">wait_event()</code> version ignores signals.
15   </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="queues.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="queues.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="queue-waking.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;7.&#160;Wait Queues
16   <code class="filename">include/linux/wait.h</code>
17  &#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Waking Up Queued Tasks</td></tr></table></div></body></html>
18