1PTHREAD_SETCONCURRENCY(3) Linux Programmer's Manual PTHREAD_SETCONCURRENCY(3)
2
3
4
6 pthread_setconcurrency, pthread_getconcurrency - set/get the concur‐
7 rency level
8
10 #include <pthread.h>
11
12 int pthread_setconcurrency(int new_level);
13 int pthread_getconcurrency(void);
14
15 Compile and link with -pthread.
16
18 The pthread_setconcurrency() function informs the implementation of the
19 application's desired concurrency level, specified in new_level. The
20 implementation only takes this as a hint: POSIX.1 does not specify the
21 level of concurrency that should be provided as a result of calling
22 pthread_setconcurrency().
23
24 Specifying new_level as 0 instructs the implementation to manage the
25 concurrency level as it deems appropriate.
26
27 pthread_getconcurrency() returns the current value of the concurrency
28 level for this process.
29
31 On success, pthread_setconcurrency() returns 0; on error, it returns a
32 nonzero error number.
33
34 pthread_getconcurrency() always succeeds, returning the concurrency
35 level set by a previous call to pthread_setconcurrency(), or 0, if
36 pthread_setconcurrency() has not previously been called.
37
39 pthread_setconcurrency() can fail with the following error:
40
41 EINVAL new_level is negative.
42
43 POSIX.1-2001 also documents an EAGAIN error ("the value specified by
44 new_level would cause a system resource to be exceeded").
45
47 These functions are available in glibc since version 2.1.
48
50 POSIX.1-2001.
51
53 The default concurrency level is 0.
54
55 Concurrency levels are only meaningful for M:N threading implementa‐
56 tions, where at any moment a subset of a process's set of user-level
57 threads may be bound to a smaller number of kernel-scheduling entities.
58 Setting the concurrency level allows the application to give the system
59 a hint as to the number of kernel-scheduling entities that should be
60 provided for efficient execution of the application.
61
62 Both LinuxThreads and NPTL are 1:1 threading implementations, so set‐
63 ting the concurrency level has no meaning. In other words, on Linux
64 these functions merely exist for compatibility with other systems, and
65 they have no effect on the execution of a program.
66
68 pthread_attr_setscope(3), pthreads(7)
69
71 This page is part of release 3.25 of the Linux man-pages project. A
72 description of the project, and information about reporting bugs, can
73 be found at http://www.kernel.org/doc/man-pages/.
74
75
76
77Linux 2009-04-10 PTHREAD_SETCONCURRENCY(3)