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

NAME

12       pthread_getconcurrency, pthread_setconcurrency - get and set the  level
13       of concurrency
14

SYNOPSIS

16       #include <pthread.h>
17
18       int pthread_getconcurrency(void);
19       int pthread_setconcurrency(int new_level);
20
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 specific by new_level would cause a system resource to
71              be exceeded.
72
73
74       These functions shall not return an error code of [EINTR].
75
76       The following sections are informative.
77

EXAMPLES

79       None.
80

APPLICATION USAGE

82       Use  of these functions changes the state of the underlying concurrency
83       upon which the application depends. Library developers are  advised  to
84       not use the pthread_getconcurrency() and pthread_setconcurrency() func‐
85       tions since their use may conflict with an applications  use  of  these
86       functions.
87

RATIONALE

89       None.
90

FUTURE DIRECTIONS

92       None.
93

SEE ALSO

95       The Base Definitions volume of IEEE Std 1003.1-2001, <pthread.h>
96
98       Portions  of  this text are reprinted and reproduced in electronic form
99       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
101       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
102       Electrical  and  Electronics  Engineers, Inc and The Open Group. 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.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group                  2003           PTHREAD_GETCONCURRENCY(3P)
Impressum