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

NAME

6       pthread_getconcurrency,  pthread_setconcurrency - get and set the level
7       of concurrency
8

SYNOPSIS

10       #include <pthread.h>
11
12       int pthread_getconcurrency(void);
13       int pthread_setconcurrency(int new_level);
14
15

DESCRIPTION

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

RETURN VALUE

51       If successful, the pthread_setconcurrency() function shall return zero;
52       otherwise, an error number shall be returned to indicate the error.
53
54       The pthread_getconcurrency() function shall always return  the  concur‐
55       rency  level set by a previous call to pthread_setconcurrency(). If the
56       pthread_setconcurrency() function has never been  called,  pthread_get‐
57       concurrency() shall return zero.
58

ERRORS

60       The pthread_setconcurrency() function shall fail if:
61
62       EINVAL The value specified by new_level is negative.
63
64       EAGAIN The value specific by new_level would cause a system resource to
65              be exceeded.
66
67
68       These functions shall not return an error code of [EINTR].
69
70       The following sections are informative.
71

EXAMPLES

73       None.
74

APPLICATION USAGE

76       Use of these functions changes the state of the underlying  concurrency
77       upon  which  the application depends. Library developers are advised to
78       not use the pthread_getconcurrency() and pthread_setconcurrency() func‐
79       tions  since  their  use may conflict with an applications use of these
80       functions.
81

RATIONALE

83       None.
84

FUTURE DIRECTIONS

86       None.
87

SEE ALSO

89       The Base Definitions volume of IEEE Std 1003.1-2001, <pthread.h>
90
92       Portions of this text are reprinted and reproduced in  electronic  form
93       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
94       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
95       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
96       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
97       event of any discrepancy between this version and the original IEEE and
98       The Open Group Standard, the original IEEE and The Open Group  Standard
99       is  the  referee document. The original Standard can be obtained online
100       at http://www.opengroup.org/unix/online.html .
101
102
103
104IEEE/The Open Group                  2003            PTHREAD_GETCONCURRENCY(P)
Impressum