1PTHREAD_GETCONCURRENCY(3P) POSIX Programmer's ManualPTHREAD_GETCONCURRENCY(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       pthread_getconcurrency, pthread_setconcurrency — get and set the  level
14       of concurrency
15

SYNOPSIS

17       #include <pthread.h>
18
19       int pthread_getconcurrency(void);
20       int pthread_setconcurrency(int new_level);
21

DESCRIPTION

23       Unbound  threads in a process may or may not be required to be simulta‐
24       neously active. By default, the threads implementation ensures  that  a
25       sufficient  number  of  threads are active so that the process can con‐
26       tinue to make progress. While this conserves system resources,  it  may
27       not produce the most effective level of concurrency.
28
29       The  pthread_setconcurrency()  function allows an application to inform
30       the threads implementation of its desired concurrency level, new_level.
31       The  actual  level  of  concurrency provided by the implementation as a
32       result of this function call is unspecified.
33
34       If new_level is zero, it causes the implementation to maintain the con‐
35       currency  level  at  its  discretion as if pthread_setconcurrency() had
36       never been called.
37
38       The pthread_getconcurrency() function shall return the value set  by  a
39       previous   call   to  the  pthread_setconcurrency()  function.  If  the
40       pthread_setconcurrency() function was not previously called, this func‐
41       tion shall return zero to indicate that the implementation is maintain‐
42       ing the concurrency level.
43
44       A call to pthread_setconcurrency() shall inform the  implementation  of
45       its  desired concurrency level.  The implementation shall use this as a
46       hint, not a requirement.
47
48       If an implementation does not support multiplexing of user  threads  on
49       top  of several kernel-scheduled entities, the pthread_setconcurrency()
50       and pthread_getconcurrency() functions are  provided  for  source  code
51       compatibility  but  they  shall have no effect when called. To maintain
52       the  function  semantics,  the  new_level  parameter  is   saved   when
53       pthread_setconcurrency()  is  called  so  that  a  subsequent  call  to
54       pthread_getconcurrency() shall return the same value.
55

RETURN VALUE

57       If successful, the pthread_setconcurrency() function shall return zero;
58       otherwise, an error number shall be returned to indicate the error.
59
60       The  pthread_getconcurrency()  function shall always return the concur‐
61       rency level set by a previous call to pthread_setconcurrency().  If the
62       pthread_setconcurrency()  function  has never been called, pthread_get‐
63       concurrency() shall return zero.
64

ERRORS

66       The pthread_setconcurrency() function shall fail if:
67
68       EINVAL The value specified by new_level is negative.
69
70       EAGAIN The value specified by new_level would cause a  system  resource
71              to be exceeded.
72
73       The pthread_setconcurrency() function shall not return an error code of
74       [EINTR].
75
76       The following sections are informative.
77

EXAMPLES

79       None.
80

APPLICATION USAGE

82       Application developers should note that an  implementation  can  always
83       ignore  any calls to pthread_setconcurrency() and return a constant for
84       pthread_getconcurrency().  For this reason, it is not recommended  that
85       portable applications use this function.
86

RATIONALE

88       None.
89

FUTURE DIRECTIONS

91       These functions may be removed in a future version.
92

SEE ALSO

94       The Base Definitions volume of POSIX.1‐2008, <pthread.h>
95
97       Portions  of  this text are reprinted and reproduced in electronic form
98       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
99       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
100       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
101       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
102       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
103       event of any discrepancy between this version and the original IEEE and
104       The Open Group Standard, the original IEEE and The Open Group  Standard
105       is  the  referee document. The original Standard can be obtained online
106       at http://www.unix.org/online.html .
107
108       Any typographical or formatting errors that appear  in  this  page  are
109       most likely to have been introduced during the conversion of the source
110       files to man page format. To report such errors,  see  https://www.ker
111       nel.org/doc/man-pages/reporting_bugs.html .
112
113
114
115IEEE/The Open Group                  2013           PTHREAD_GETCONCURRENCY(3P)
Impressum