1PTHREAD_SETCONCURRENCY(3)  Linux Programmer's Manual PTHREAD_SETCONCURRENCY(3)
2
3
4

NAME

6       pthread_setconcurrency,  pthread_getconcurrency  -  set/get the concur‐
7       rency level
8

SYNOPSIS

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

DESCRIPTION

18       The pthread_setconcurrency() function informs the implementation of the
19       application's  desired  concurrency level, specified in new_level.  The
20       implementation takes this only 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

RETURN VALUE

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

ERRORS

39       pthread_setconcurrency() can fail with the following error:
40
41       EINVAL new_level is negative.
42
43       POSIX.1  also  documents  an  EAGAIN  error  ("the  value  specified by
44       new_level would cause a system resource to be exceeded").
45

VERSIONS

47       These functions are available in glibc since version 2.1.
48

ATTRIBUTES

50       For  an  explanation  of  the  terms  used   in   this   section,   see
51       attributes(7).
52
53       ┌──────────────────────────┬───────────────┬─────────┐
54Interface                 Attribute     Value   
55       ├──────────────────────────┼───────────────┼─────────┤
56pthread_setconcurrency(), │ Thread safety │ MT-Safe │
57pthread_getconcurrency()  │               │         │
58       └──────────────────────────┴───────────────┴─────────┘

CONFORMING TO

60       POSIX.1-2001, POSIX.1-2008.
61

NOTES

63       The default concurrency level is 0.
64
65       Concurrency levels are meaningful only for  M:N  threading  implementa‐
66       tions,  where  at  any moment a subset of a process's set of user-level
67       threads may be bound to a smaller number of kernel-scheduling entities.
68       Setting the concurrency level allows the application to give the system
69       a hint as to the number of kernel-scheduling entities  that  should  be
70       provided for efficient execution of the application.
71
72       Both  LinuxThreads  and NPTL are 1:1 threading implementations, so set‐
73       ting the concurrency level has no meaning.  In other  words,  on  Linux
74       these  functions merely exist for compatibility with other systems, and
75       they have no effect on the execution of a program.
76

SEE ALSO

78       pthread_attr_setscope(3), pthreads(7)
79

COLOPHON

81       This page is part of release 4.15 of the Linux  man-pages  project.   A
82       description  of  the project, information about reporting bugs, and the
83       latest    version    of    this    page,    can     be     found     at
84       https://www.kernel.org/doc/man-pages/.
85
86
87
88Linux                             2017-09-15         PTHREAD_SETCONCURRENCY(3)
Impressum