📄 pthread_getconcurrency.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>pthread_getconcurrency</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_1351"> </a>NAME</h4><blockquote>pthread_getconcurrency, pthread_setconcurrency -get or set level of concurrency</blockquote><h4><a name = "tag_000_007_1352"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="pthread.h.html">pthread.h</a>>int pthread_getconcurrency(void);int pthread_setconcurrency(int <i>new_level</i>);</code></pre></blockquote><h4><a name = "tag_000_007_1353"> </a>DESCRIPTION</h4><blockquote>Unbound threads in a process may or may not be required to besimultaneously active. By default, the threadsimplementation ensures that a sufficient number of threads are activeso that the process can continue to makeprogress. While this conserves system resources, it may not producethe most effective level of concurrency.<p>The <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function allows an application to informthe threads implementation of its desired concurrency level,<i>new_level</i>.The actual level of concurrency provided by the implementation as aresult of this function call is unspecified.<p>If <i>new_level</i> is zero, it causes the implementation to maintainthe concurrency level at its discretion as if<i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>was never called.<p>The <i>pthread_getconcurrency()</i>function returns the value set by a previous call to the <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function. If the <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function was not previously called,this function returns zero to indicate that the implementationis maintaining the concurrency level.<p>When an application calls <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>it isinforming the implementation of its desiredconcurrency level. The implementation uses this as a hint,not a requirement.<p>If an implementation does not support multiplexing of user threadson top of several kernel scheduled entities,the <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>and <i>pthread_getconcurrency()</i>functionswill be provided for source codecompatibility but they will have no effect when called. To maintainthe function semantics, the <i>new_level</i>parameter will be saved when <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>is called sothat a subsequent call to<i>pthread_getconcurrency()</i>returns the same value.</blockquote><h4><a name = "tag_000_007_1354"> </a>RETURN VALUE</h4><blockquote>If successful, the <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function returns zero. Otherwise, an error number is returnedto indicate the error.<p>The <i>pthread_getconcurrency()</i>function always returns the concurrency level set by a previous call to <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>.If the <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function has never been called, <i>pthread_getconcurrency()</i>returns zero.</blockquote><h4><a name = "tag_000_007_1355"> </a>ERRORS</h4><blockquote>The<i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>function will fail if:<dl compact><dt>[EINVAL]<dd>The value specified by <i>new_level</i> is negative.<dt>[EAGAIN]<dd>The value specific by <i>new_level</i> would cause a system resourceto be exceeded.</dl></blockquote><h4><a name = "tag_000_007_1356"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1357"> </a>APPLICATION USAGE</h4><blockquote>Use of these functions changes the state of the underlyingconcurrency upon which the application depends. Librarydevelopers are advised to not use the <i>pthread_getconcurrency()</i>and <i><a href="pthread_setconcurrency.html">pthread_setconcurrency()</a></i>functions since theiruse may conflict with an applications use of these functions.</blockquote><h4><a name = "tag_000_007_1358"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_1359"> </a>SEE ALSO</h4><blockquote><i><a href="pthread.h.html"><pthread.h></a></i>.</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 + -