add directory study
This commit is contained in:
158
study/Ref-docs/POSIX/susv3/functions/sigwait.html
Normal file
158
study/Ref-docs/POSIX/susv3/functions/sigwait.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
||||
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
||||
<title>sigwait</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
||||
</script>
|
||||
|
||||
<basefont size="3"> <a name="sigwait"></a> <a name="tag_03_700"></a><!-- sigwait -->
|
||||
<!--header start-->
|
||||
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
||||
IEEE Std 1003.1-2001<br>
|
||||
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
||||
|
||||
<!--header end-->
|
||||
<hr size="2" noshade>
|
||||
<h4><a name="tag_03_700_01"></a>NAME</h4>
|
||||
|
||||
<blockquote>sigwait - wait for queued signals</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_02"></a>SYNOPSIS</h4>
|
||||
|
||||
<blockquote class="synopsis">
|
||||
<div class="box"><code><tt><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt=
|
||||
"[Option Start]" border="0"> #include <<a href="../basedefs/signal.h.html">signal.h</a>><br>
|
||||
<br>
|
||||
int sigwait(const sigset_t *restrict</tt> <i>set</i><tt>, int *restrict</tt> <i>sig</i><tt>); <img src="../images/opt-end.gif"
|
||||
alt="[Option End]" border="0"></tt></code></div>
|
||||
|
||||
<tt><br>
|
||||
</tt></blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_03"></a>DESCRIPTION</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <i>sigwait</i>() function shall select a pending signal from <i>set</i>, atomically clear it from the system's set of
|
||||
pending signals, and return that signal number in the location referenced by <i>sig</i>. If prior to the call to <i>sigwait</i>()
|
||||
there are multiple pending instances of a single signal number, it is implementation-defined whether upon successful return there
|
||||
are any remaining pending signals for that signal number. <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src=
|
||||
"../images/opt-start.gif" alt="[Option Start]" border="0"> If the implementation supports queued signals and there are
|
||||
multiple signals queued for the signal number selected, the first such queued signal shall cause a return from <i>sigwait</i>() and
|
||||
the remainder shall remain queued. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> If no signal in <i>set</i> is
|
||||
pending at the time of the call, the thread shall be suspended until one or more becomes pending. The signals defined by <i>set</i>
|
||||
shall have been blocked at the time of the call to <i>sigwait</i>(); otherwise, the behavior is undefined. The effect of
|
||||
<i>sigwait</i>() on the signal actions for the signals in <i>set</i> is unspecified.</p>
|
||||
|
||||
<p>If more than one thread is using <i>sigwait</i>() to wait for the same signal, no more than one of these threads shall return
|
||||
from <i>sigwait</i>() with the signal number. Which thread returns from <i>sigwait</i>() if more than a single thread is waiting is
|
||||
unspecified.</p>
|
||||
|
||||
<p><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
Should any of the multiple pending signals in the range SIGRTMIN to SIGRTMAX be selected, it shall be the lowest numbered one. The
|
||||
selection order between realtime and non-realtime signals, or between multiple pending non-realtime signals, is unspecified. <img
|
||||
src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_04"></a>RETURN VALUE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>Upon successful completion, <i>sigwait</i>() shall store the signal number of the received signal at the location referenced by
|
||||
<i>sig</i> and return zero. Otherwise, an error number shall be returned to indicate the error.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_05"></a>ERRORS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <i>sigwait</i>() function may fail if:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>[EINVAL]</dt>
|
||||
|
||||
<dd>The <i>set</i> argument contains an invalid or unsupported signal number.</dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
<div class="box"><em>The following sections are informative.</em></div>
|
||||
|
||||
<h4><a name="tag_03_700_06"></a>EXAMPLES</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_07"></a>APPLICATION USAGE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_08"></a>RATIONALE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>To provide a convenient way for a thread to wait for a signal, this volume of IEEE Std 1003.1-2001 provides the
|
||||
<i>sigwait</i>() function. For most cases where a thread has to wait for a signal, the <i>sigwait</i>() function should be quite
|
||||
convenient, efficient, and adequate.</p>
|
||||
|
||||
<p>However, requests were made for a lower-level primitive than <i>sigwait</i>() and for semaphores that could be used by threads.
|
||||
After some consideration, threads were allowed to use semaphores and <a href="../functions/sem_post.html"><i>sem_post</i>()</a> was
|
||||
defined to be async-signal and async-cancel-safe.</p>
|
||||
|
||||
<p>In summary, when it is necessary for code run in response to an asynchronous signal to notify a thread, <i>sigwait</i>() should
|
||||
be used to handle the signal. Alternatively, if the implementation provides semaphores, they also can be used, either following
|
||||
<i>sigwait</i>() or from within a signal handling routine previously registered with <a href=
|
||||
"../functions/sigaction.html"><i>sigaction</i>()</a>.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_09"></a>FUTURE DIRECTIONS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_10"></a>SEE ALSO</h4>
|
||||
|
||||
<blockquote>
|
||||
<p><a href="xsh_chap02_04.html#tag_02_04"><i>Signal Concepts</i></a> , <a href="xsh_chap02_08.html#tag_02_08_01"><i>Realtime
|
||||
Signals</i></a> , <a href="pause.html"><i>pause</i>()</a> , <a href="pthread_sigmask.html"><i>pthread_sigmask</i>()</a> , <a href=
|
||||
"sigaction.html"><i>sigaction</i>()</a> , <a href="sigpending.html"><i>sigpending</i>()</a> , <a href=
|
||||
"sigsuspend.html"><i>sigsuspend</i>()</a> , <a href="sigwaitinfo.html"><i>sigwaitinfo</i>()</a> , the Base Definitions volume of
|
||||
IEEE Std 1003.1-2001, <a href="../basedefs/signal.h.html"><i><signal.h></i></a>, <a href=
|
||||
"../basedefs/time.h.html"><i><time.h></i></a></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_11"></a>CHANGE HISTORY</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension and the POSIX Threads Extension.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_700_12"></a>Issue 6</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <b>restrict</b> keyword is added to the <i>sigwait</i>() prototype for alignment with the ISO/IEC 9899:1999
|
||||
standard.</p>
|
||||
</blockquote>
|
||||
|
||||
<div class="box"><em>End of informative text.</em></div>
|
||||
|
||||
<hr>
|
||||
<hr size="2" noshade>
|
||||
<center><font size="2"><!--footer start-->
|
||||
UNIX ® is a registered Trademark of The Open Group.<br>
|
||||
POSIX ® is a registered Trademark of The IEEE.<br>
|
||||
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
||||
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
||||
]</font></center>
|
||||
|
||||
<!--footer end-->
|
||||
<hr size="2" noshade>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user