]>
Commit | Line | Data |
---|---|---|
354fd38d MK |
1 | .\" Copyright (c) 2009 Michael Kerrisk, <mtk.manpages@gmail.com> |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
354fd38d MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
354fd38d | 24 | .\" |
4b8c67d9 | 25 | .TH PTHREAD_SETCONCURRENCY 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
354fd38d MK |
26 | .SH NAME |
27 | pthread_setconcurrency, pthread_getconcurrency \- set/get | |
28 | the concurrency level | |
29 | .SH SYNOPSIS | |
30 | .nf | |
31 | .B #include <pthread.h> | |
dbfe9c70 | 32 | .PP |
354fd38d MK |
33 | .BI "int pthread_setconcurrency(int " new_level ); |
34 | .BI "int pthread_getconcurrency(void); | |
68e4db0a | 35 | .PP |
354fd38d | 36 | Compile and link with \fI\-pthread\fP. |
6030f2d8 | 37 | .fi |
354fd38d MK |
38 | .SH DESCRIPTION |
39 | The | |
40 | .BR pthread_setconcurrency () | |
41 | function informs the implementation of the application's | |
42 | desired concurrency level, specified in | |
43 | .IR new_level . | |
33a0ccb2 | 44 | The implementation takes this only as a hint: |
354fd38d MK |
45 | POSIX.1 does not specify the level of concurrency that |
46 | should be provided as a result of calling | |
47 | .BR pthread_setconcurrency (). | |
847e0d88 | 48 | .PP |
354fd38d MK |
49 | Specifying |
50 | .I new_level | |
51 | as 0 instructs the implementation to manage the concurrency level | |
52 | as it deems appropriate. | |
847e0d88 | 53 | .PP |
354fd38d MK |
54 | .BR pthread_getconcurrency () |
55 | returns the current value of the concurrency level for this process. | |
56 | .SH RETURN VALUE | |
57 | On success, | |
58 | .BR pthread_setconcurrency () | |
59 | returns 0; | |
c7094399 | 60 | on error, it returns a nonzero error number. |
847e0d88 | 61 | .PP |
354fd38d MK |
62 | .BR pthread_getconcurrency () |
63 | always succeeds, returning the concurrency level set by a previous call to | |
64 | .BR pthread_setconcurrency (), | |
65 | or 0, if | |
66 | .BR pthread_setconcurrency () | |
67 | has not previously been called. | |
68 | .SH ERRORS | |
69 | .BR pthread_setconcurrency () | |
70 | can fail with the following error: | |
71 | .TP | |
72 | .B EINVAL | |
73 | .I new_level | |
74 | is negative. | |
75 | .PP | |
5f339bd9 | 76 | POSIX.1 also documents an |
354fd38d MK |
77 | .BR EAGAIN |
78 | error ("the value specified by | |
79 | .I new_level | |
80 | would cause a system resource to be exceeded"). | |
81 | .SH VERSIONS | |
82 | These functions are available in glibc since version 2.1. | |
3ef3728c | 83 | .SH ATTRIBUTES |
6e469d9d PH |
84 | For an explanation of the terms used in this section, see |
85 | .BR attributes (7). | |
86 | .TS | |
87 | allbox; | |
88 | lbw25 lb lb | |
89 | l l l. | |
90 | Interface Attribute Value | |
91 | T{ | |
92 | .BR pthread_setconcurrency (), | |
3ef3728c | 93 | .BR pthread_getconcurrency () |
6e469d9d PH |
94 | T} Thread safety MT-Safe |
95 | .TE | |
354fd38d | 96 | .SH CONFORMING TO |
5f339bd9 | 97 | POSIX.1-2001, POSIX.1-2008. |
354fd38d MK |
98 | .SH NOTES |
99 | The default concurrency level is 0. | |
847e0d88 | 100 | .PP |
33a0ccb2 | 101 | Concurrency levels are meaningful only for M:N threading implementations, |
354fd38d MK |
102 | where at any moment a subset of a process's set of user-level threads |
103 | may be bound to a smaller number of kernel-scheduling entities. | |
104 | Setting the concurrency level allows the application to | |
105 | give the system a hint as to the number of kernel-scheduling entities | |
106 | that should be provided for efficient execution of the application. | |
847e0d88 | 107 | .PP |
354fd38d MK |
108 | Both LinuxThreads and NPTL are 1:1 threading implementations, |
109 | so setting the concurrency level has no meaning. | |
110 | In other words, | |
111 | on Linux these functions merely exist for compatibility with other systems, | |
112 | and they have no effect on the execution of a program. | |
113 | .SH SEE ALSO | |
114 | .BR pthread_attr_setscope (3), | |
115 | .BR pthreads (7) |