xref: /freebsd/share/man/man3/pthread_getconcurrency.3 (revision 5bb9f2101ba65b16512a4825002c690935026493)
1.\" Copyright (c) 2003 Sergey Osokin <osa@FreeBSD.org.ru>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.Dd April 11, 2003
27.Dt PTHREAD_GETCONCURRENCY 3
28.Os
29.Sh NAME
30.Nm pthread_getconcurrency ,
31.Nm pthread_setconcurrency
32.Nd get or set level of concurrency
33.Sh LIBRARY
34.Lb libpthread
35.Lb libthr
36.Sh SYNOPSIS
37.In pthread.h
38.Ft int
39.Fn pthread_getconcurrency void
40.Ft int
41.Fn pthread_setconcurrency "int new_level"
42.Sh DESCRIPTION
43The
44.Fn pthread_getconcurrency
45function allows an application to inform the threads implementation
46of its desired concurrency level,
47.Fa new_level .
48The actual level of concurrency provided by the implementation
49as a result of this function call is unspecified.
50If
51.Fa new_level
52is zero, it causes the implementation to maintain the concurrency
53level at its discretion as if
54.Fn pthread_setconcurrency
55was never called.
56The
57.Fn pthread_getconcurrency
58function returns the value set by a previous call to the
59.Fn pthread_setconcurrency
60function.
61If the
62.Fn pthread_setconcurrency
63function was not previously called, this function returns zero to
64indicate that the implementation is maintaining the concurrency
65level.
66When an application calls
67.Fn pthread_setconcurrency ,
68it is informing the implementation of its desired concurrency
69level.
70The implementation uses this as a hint, not a requirement.
71.Sh RETURN VALUES
72If successful, the
73.Fn pthread_setconcurrency
74function returns zero.
75Otherwise, an error number is returned
76to indicate the error.
77The
78.Fn pthread_getconcurrency
79function always returns the concurrency level set by a previous
80call to
81.Fn pthread_setconcurrency .
82If the
83.Fn pthread_setconcurrency
84function has never been called,
85.Fn pthread_getconcurrency
86returns zero.
87.Sh ERRORS
88The
89.Fn pthread_setconcurrency
90function will fail if:
91.Bl -tag -width Er
92.It Bq Er EINVAL
93The value specified by
94.Fa new_level
95is negative.
96.It Bq Er EAGAIN
97The value specified by
98.Fa new_level
99would cause a system resource to be exceeded.
100.El
101.Sh APPLICATION USAGE
102Use of these functions changes the state of the underlying
103concurrency upon which the application depends.
104Library developers are advised to not use the
105.Fn pthread_getconcurrency
106and
107.Fn pthread_setconcurrency
108functions since their use may conflict with an application's
109use of these functions.
110.Sh STANDARDS
111The
112.Fn pthread_getconcurrency
113and
114.Fn pthread_setconcurrency
115functions conform to
116.St -susv2 .
117