181 lines
4.6 KiB
HTML
181 lines
4.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of PTHREAD_SETCONCURRENCY</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>PTHREAD_SETCONCURRENCY</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pthread_setconcurrency, pthread_getconcurrency - set/get
|
|
the concurrency level
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/pthread.h">pthread.h</A>></B>
|
|
|
|
<B>int pthread_setconcurrency(int </B><I>new_level</I><B>);</B>
|
|
<B>int pthread_getconcurrency(void);</B>
|
|
|
|
Compile and link with <I>-pthread</I>.
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>pthread_setconcurrency</B>()
|
|
|
|
function informs the implementation of the application's
|
|
desired concurrency level, specified in
|
|
<I>new_level</I>.
|
|
|
|
The implementation takes this only as a hint:
|
|
POSIX.1 does not specify the level of concurrency that
|
|
should be provided as a result of calling
|
|
<B>pthread_setconcurrency</B>().
|
|
|
|
<P>
|
|
|
|
Specifying
|
|
<I>new_level</I>
|
|
|
|
as 0 instructs the implementation to manage the concurrency level
|
|
as it deems appropriate.
|
|
<P>
|
|
|
|
<B>pthread_getconcurrency</B>()
|
|
|
|
returns the current value of the concurrency level for this process.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>pthread_setconcurrency</B>()
|
|
|
|
returns 0;
|
|
on error, it returns a nonzero error number.
|
|
<P>
|
|
|
|
<B>pthread_getconcurrency</B>()
|
|
|
|
always succeeds, returning the concurrency level set by a previous call to
|
|
<B>pthread_setconcurrency</B>(),
|
|
|
|
or 0, if
|
|
<B>pthread_setconcurrency</B>()
|
|
|
|
has not previously been called.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<B>pthread_setconcurrency</B>()
|
|
|
|
can fail with the following error:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>new_level</I>
|
|
|
|
is negative.
|
|
</DL>
|
|
<P>
|
|
|
|
POSIX.1 also documents an
|
|
<B>EAGAIN</B>
|
|
|
|
error ("the value specified by
|
|
<I>new_level</I>
|
|
|
|
would cause a system resource to be exceeded").
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
These functions are available in glibc since version 2.1.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>pthread_setconcurrency</B>(),
|
|
|
|
<B>pthread_getconcurrency</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The default concurrency level is 0.
|
|
<P>
|
|
|
|
Concurrency levels are meaningful only for M:N threading implementations,
|
|
where at any moment a subset of a process's set of user-level threads
|
|
may be bound to a smaller number of kernel-scheduling entities.
|
|
Setting the concurrency level allows the application to
|
|
give the system a hint as to the number of kernel-scheduling entities
|
|
that should be provided for efficient execution of the application.
|
|
<P>
|
|
|
|
Both LinuxThreads and NPTL are 1:1 threading implementations,
|
|
so setting the concurrency level has no meaning.
|
|
In other words,
|
|
on Linux these functions merely exist for compatibility with other systems,
|
|
and they have no effect on the execution of a program.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_attr_setscope">pthread_attr_setscope</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pthreads">pthreads</A></B>(7)
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="5"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="6"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="7"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="8"><A HREF="#lbAH">ATTRIBUTES</A><DD>
|
|
<DT id="9"><A HREF="#lbAI">CONFORMING TO</A><DD>
|
|
<DT id="10"><A HREF="#lbAJ">NOTES</A><DD>
|
|
<DT id="11"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAL">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:53 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|