⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_setconcurrency.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!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-2003 The Open Group, All Rights Reserved --><title>pthread_getconcurrency</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="pthread_getconcurrency"></a> <a name="tag_03_529"></a><!-- pthread_getconcurrency --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_529_01"></a>NAME</h4><blockquote>pthread_getconcurrency, pthread_setconcurrency - get and set the level of concurrency</blockquote><h4><a name="tag_03_529_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/pthread.h.html">pthread.h</a>&gt;<br><br> int pthread_getconcurrency(void);<br> int pthread_setconcurrency(int</tt> <i>new_level</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_529_03"></a>DESCRIPTION</h4><blockquote><p>Unbound threads in a process may or may not be required to be simultaneously active. By default, the threads implementationensures that a sufficient number of threads are active so that the process can continue to make progress. While this conservessystem resources, it may not produce the most effective level of concurrency.</p><p>The <i>pthread_setconcurrency</i>() function allows an application to inform the threads implementation of its desiredconcurrency level, <i>new_level</i>. The actual level of concurrency provided by the implementation as a result of this functioncall is unspecified.</p><p>If <i>new_level</i> is zero, it causes the implementation to maintain the concurrency level at its discretion as if<i>pthread_setconcurrency</i>() had never been called.</p><p>The <i>pthread_getconcurrency</i>() function shall return the value set by a previous call to the<i>pthread_setconcurrency</i>() function. If the <i>pthread_setconcurrency</i>() function was not previously called, this functionshall return zero to indicate that the implementation is maintaining the concurrency level.</p><p>A call to <i>pthread_setconcurrency</i>() shall inform the implementation of its desired concurrency level. The implementationshall use this as a hint, not a requirement.</p><p>If an implementation does not support multiplexing of user threads on top of several kernel-scheduled entities, the<i>pthread_setconcurrency</i>() and <i>pthread_getconcurrency</i>() functions are provided for source code compatibility but theyshall have no effect when called. To maintain the function semantics, the <i>new_level</i> parameter is saved when<i>pthread_setconcurrency</i>() is called so that a subsequent call to <i>pthread_getconcurrency</i>() shall return the samevalue.</p></blockquote><h4><a name="tag_03_529_04"></a>RETURN VALUE</h4><blockquote><p>If successful, the <i>pthread_setconcurrency</i>() function shall return zero; otherwise, an error number shall be returned toindicate the error.</p><p>The <i>pthread_getconcurrency</i>() function shall always return the concurrency level set by a previous call to<i>pthread_setconcurrency</i>(). If the <i>pthread_setconcurrency</i>() function has never been called,<i>pthread_getconcurrency</i>() shall return zero.</p></blockquote><h4><a name="tag_03_529_05"></a>ERRORS</h4><blockquote><p>The <i>pthread_setconcurrency</i>() function shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd>The value specified by <i>new_level</i> is negative.</dd><dt>[EAGAIN]</dt><dd>The value specific by <i>new_level</i> would cause a system resource to be exceeded.</dd></dl><p>These functions shall not return an error code of [EINTR].</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_529_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_529_07"></a>APPLICATION USAGE</h4><blockquote><p>Use of these functions changes the state of the underlying concurrency upon which the application depends. Library developersare advised to not use the <i>pthread_getconcurrency</i>() and <i>pthread_setconcurrency</i>() functions since their use mayconflict with an applications use of these functions.</p></blockquote><h4><a name="tag_03_529_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_529_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_529_10"></a>SEE ALSO</h4><blockquote><p>The Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a></p></blockquote><h4><a name="tag_03_529_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; 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>

⌨️ 快捷键说明

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