alarm.html

来自「unix 下的C开发手册,还用详细的例程。」· HTML 代码 · 共 98 行

HTML
98
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>alarm</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_001_167">&nbsp;</a>NAME</h4><blockquote>alarm - schedule an alarm signal</blockquote><h4><a name = "tag_000_001_168">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;unsigned int alarm(unsigned int <i>seconds</i>);</code></pre></blockquote><h4><a name = "tag_000_001_169">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>alarm()</i>function causes the system to generate a SIGALRM signal for the process after the number of real-time seconds specified by<i>seconds</i>have elapsed.Processor scheduling delays may prevent the process from handling thesignal as soon as it is generated.<p>If<i>seconds</i>is 0, a pending alarm request, if any, is cancelled.<p>Alarm requests are not stacked; only one SIGALRM generation can bescheduled in this manner; if the SIGALRM signal has not yet beengenerated, the call will result in rescheduling the time at whichthe SIGALRM signal will be generated.<p>Interactions between<i>alarm()</i>and any of<i><a href="setitimer.html">setitimer()</a></i>,<i><a href="ualarm.html">ualarm()</a></i>or<i><a href="usleep.html">usleep()</a></i>are unspecified.</blockquote><h4><a name = "tag_000_001_170">&nbsp;</a>RETURN VALUE</h4><blockquote>If there is a previous<i>alarm()</i>request with time remaining,<i>alarm()</i>returns a non-zero value that is the number of secondsuntil the previous request would have generated a SIGALRM signal.Otherwise,<i>alarm()</i>returns 0.</blockquote><h4><a name = "tag_000_001_171">&nbsp;</a>ERRORS</h4><blockquote>The<i>alarm()</i>function is always successful, and no return value is reserved toindicate an error.</blockquote><h4><a name = "tag_000_001_172">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_173">&nbsp;</a>APPLICATION USAGE</h4><blockquote>The<i><a href="fork.html">fork()</a></i>function clears pending alarms in the child process.A new process image created by one of the<i>exec</i>functions inherits the time left to an alarm signal in the oldprocess' image.</blockquote><h4><a name = "tag_000_001_174">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_175">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="exec.html">exec</a></i>,<i><a href="fork.html">fork()</a></i>,<i><a href="getitimer.html">getitimer()</a></i>,<i><a href="pause.html">pause()</a></i>,<i><a href="sigaction.html">sigaction()</a></i>,<i><a href="ualarm.html">ualarm()</a></i>,<i><a href="usleep.html">usleep()</a></i>,<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>,<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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