📄 pthread_cleanup_pop.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pthread_cleanup_push</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_1216"> </a>NAME</h4><blockquote>pthread_cleanup_push, pthread_cleanup_pop - establish cancellation handlers</blockquote><h4><a name = "tag_000_007_1217"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="pthread.h.html">pthread.h</a>>void pthread_cleanup_push(void (*<i>routine</i>)(void*), void *<i>arg</i>);void pthread_cleanup_pop(int <i>execute</i>);</code></pre></blockquote><h4><a name = "tag_000_007_1218"> </a>DESCRIPTION</h4><blockquote>The<i>pthread_cleanup_push()</i>function pushes the specified cancellation cleanup handler<i>routine</i>onto the calling thread's cancellation cleanup stack.The cancellation cleanup handler is popped from thecancellation cleanup stack and invoked with the argument<i>arg</i>when: (a) the thread exits (that is, calls<i><a href="pthread_exit.html">pthread_exit()</a></i>),(b) the thread acts upon a cancellation request, or(c) the thread calls<i>pthread_cleanup_pop()</i>with a non-zero<i>execute</i>argument.<p>The<i>pthread_cleanup_pop()</i>function removes the routine at the top of the calling thread'scancellation cleanup stack and optionally invokes it (if<i>execute</i>is non-zero).<p>These functions may be implemented as macros and willappear as statements and in pairs within the same lexical scope (that is, the<i>pthread_cleanup_push()</i>macro may be thought to expand to a token list whose firsttoken is<b>`{'</b>with<i>pthread_cleanup_pop()</i>expanding to a token list whose last token is the corresponding<b>`}'</b>.<p>The effect of calling<i><a href="longjmp.html">longjmp()</a></i>or<i><a href="siglongjmp.html">siglongjmp()</a></i>is undefined if there have been any calls to<i>pthread_cleanup_push()</i>or<i>pthread_cleanup_pop()</i>made without the matching callsince the jump buffer was filled.The effect of calling<i><a href="longjmp.html">longjmp()</a></i>or<i><a href="siglongjmp.html">siglongjmp()</a></i>from inside a cancellation cleanup handler is alsoundefined unless the jump buffer was also filled in thecancellation cleanup handler.</blockquote><h4><a name = "tag_000_007_1219"> </a>RETURN VALUE</h4><blockquote>The<i>pthread_cleanup_push()</i>and<i>pthread_cleanup_pop()</i>functions return no value.</blockquote><h4><a name = "tag_000_007_1220"> </a>ERRORS</h4><blockquote>No errors are defined.<p>These functions will not return an error code of [EINTR].</blockquote><h4><a name = "tag_000_007_1221"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1222"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1223"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1224"> </a>SEE ALSO</h4><blockquote><i><a href="pthread_cancel.html">pthread_cancel()</a></i>,<i><a href="pthread_setcancelstate.html">pthread_setcancelstate()</a></i>,<i><a href="pthread.h.html"><pthread.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the POSIX Threads Extension (1003.1c-1995)</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -