📄 pthread_setcanceltype.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pthread_setcancelstate</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_1726"> </a>NAME</h4><blockquote>pthread_setcancelstate, pthread_setcanceltype, pthread_testcancel- set cancelability state</blockquote><h4><a name = "tag_000_007_1727"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="pthread.h.html">pthread.h</a>>int pthread_setcancelstate(int <i>state</i>, int *<i>oldstate</i>);int pthread_setcanceltype(int <i>type</i>, int *<i>oldtype</i>);void pthread_testcancel(void);</code></pre></blockquote><h4><a name = "tag_000_007_1728"> </a>DESCRIPTION</h4><blockquote>The<i>pthread_setcancelstate()</i>function atomically both sets the calling thread's cancelabilitystate to the indicated<i>state</i>and returns the previous cancelability stateat the location referenced by <i>oldstate</i>.Legal values for<i>state</i>are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DISABLE.<p>The<i>pthread_setcanceltype()</i>function atomically both sets the calling thread's cancelabilitytype to the indicated<i>type</i>and returns the previous cancelability typeat the location referenced by <i>oldtype</i>.Legal values for<i>type</i>are PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS.<p>The cancelability state and type of any newlycreated threads, including the thread in which<i>main()</i>was first invoked,are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DEFERREDrespectively.<p>The<i>pthread_testcancel()</i>function creates a cancellation point in the calling thread.The<i>pthread_testcancel()</i>function has no effect if cancelability is disabled.</blockquote><h4><a name = "tag_000_007_1729"> </a>RETURN VALUE</h4><blockquote>If successful, the<i>pthread_setcancelstate()</i>and<i>pthread_setcanceltype()</i>functions return zero.Otherwise, an error number is returned to indicate the error.</blockquote><h4><a name = "tag_000_007_1730"> </a>ERRORS</h4><blockquote>The <i>pthread_setcancelstate()</i>function may fail if:<dl compact><dt>[EINVAL]<dd>The specified state is notPTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.</dl><p>The<i>pthread_setcanceltype()</i>function may fail if:<dl compact><dt>[EINVAL]<dd>The specified type is not PTHREAD_CANCEL_DEFERREDor PTHREAD_CANCEL_ASYNCHRONOUS.</dl><p>These functions will not return an error code of [EINTR].</blockquote><h4><a name = "tag_000_007_1731"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1732"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1733"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1734"> </a>SEE ALSO</h4><blockquote><i><a href="pthread_cancel.html">pthread_cancel()</a></i>,<i><a href="pthread.h.html"><pthread.h></a></i>.<br></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 + -