1pthread_setconcurrency(3)  Library Functions Manual  pthread_setconcurrency(3)
2
3
4

NAME

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

LIBRARY

10       POSIX threads library (libpthread, -lpthread)
11

SYNOPSIS

13       #include <pthread.h>
14
15       int pthread_setconcurrency(int new_level);
16       int pthread_getconcurrency(void);
17

DESCRIPTION

19       The pthread_setconcurrency() function informs the implementation of the
20       application's  desired  concurrency level, specified in new_level.  The
21       implementation takes this only as a hint: POSIX.1 does not specify  the
22       level  of  concurrency  that  should be provided as a result of calling
23       pthread_setconcurrency().
24
25       Specifying new_level as 0 instructs the implementation  to  manage  the
26       concurrency level as it deems appropriate.
27
28       pthread_getconcurrency()  returns  the current value of the concurrency
29       level for this process.
30

RETURN VALUE

32       On success, pthread_setconcurrency() returns 0; on error, it returns  a
33       nonzero error number.
34
35       pthread_getconcurrency()  always  succeeds,  returning  the concurrency
36       level set by a previous call  to  pthread_setconcurrency(),  or  0,  if
37       pthread_setconcurrency() has not previously been called.
38

ERRORS

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

ATTRIBUTES

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

STANDARDS

59       POSIX.1-2008.
60

HISTORY

62       glibc 2.1.  POSIX.1-2001.
63

NOTES

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

SEE ALSO

80       pthread_attr_setscope(3), pthreads(7)
81
82
83
84Linux man-pages 6.04              2023-03-30         pthread_setconcurrency(3)
Impressum