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
68       implementations,  where  at  any  moment a subset of a process's set of
69       user-level threads  may  be  bound  to  a  smaller  number  of  kernel-
70       scheduling   entities.    Setting  the  concurrency  level  allows  the
71       application to give the system a hint  as  to  the  number  of  kernel-
72       scheduling  entities that should be provided for efficient execution of
73       the application.
74
75       Both LinuxThreads  and  NPTL  are  1:1  threading  implementations,  so
76       setting the concurrency level has no meaning.  In other words, on Linux
77       these functions merely exist for compatibility with other systems,  and
78       they have no effect on the execution of a program.
79

SEE ALSO

81       pthread_attr_setscope(3), pthreads(7)
82
83
84
85Linux man-pages 6.05              2023-07-20         pthread_setconcurrency(3)
Impressum