xref: /freebsd/share/man/man3/pthread_getconcurrency.3 (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
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.Dd April 11, 2003
25.Dt PTHREAD_GETCONCURRENCY 3
26.Os
27.Sh NAME
28.Nm pthread_getconcurrency ,
29.Nm pthread_setconcurrency
30.Nd get or set level of concurrency
31.Sh LIBRARY
32.Lb libpthread
33.Sh SYNOPSIS
34.In pthread.h
35.Ft int
36.Fn pthread_getconcurrency void
37.Ft int
38.Fn pthread_setconcurrency "int new_level"
39.Sh DESCRIPTION
40The
41.Fn pthread_setconcurrency
42function allows an application to inform the threads implementation
43of its desired concurrency level,
44.Fa new_level .
45The actual level of concurrency provided by the implementation
46as a result of this function call is unspecified.
47If
48.Fa new_level
49is zero, it causes the implementation to maintain the concurrency
50level at its discretion as if
51.Fn pthread_setconcurrency
52was never called.
53The
54.Fn pthread_getconcurrency
55function returns the value set by a previous call to the
56.Fn pthread_setconcurrency
57function.
58If the
59.Fn pthread_setconcurrency
60function was not previously called, this function returns zero to
61indicate that the implementation is maintaining the concurrency
62level.
63When an application calls
64.Fn pthread_setconcurrency ,
65it is informing the implementation of its desired concurrency
66level.
67The implementation uses this as a hint, not a requirement.
68.Sh RETURN VALUES
69If successful, the
70.Fn pthread_setconcurrency
71function returns zero.
72Otherwise, an error number is returned
73to indicate the error.
74The
75.Fn pthread_getconcurrency
76function always returns the concurrency level set by a previous
77call to
78.Fn pthread_setconcurrency .
79If the
80.Fn pthread_setconcurrency
81function has never been called,
82.Fn pthread_getconcurrency
83returns zero.
84.Sh ERRORS
85The
86.Fn pthread_setconcurrency
87function will fail if:
88.Bl -tag -width Er
89.It Bq Er EINVAL
90The value specified by
91.Fa new_level
92is negative.
93.It Bq Er EAGAIN
94The value specified by
95.Fa new_level
96would cause a system resource to be exceeded.
97.El
98.Sh APPLICATION USAGE
99Use of these functions changes the state of the underlying
100concurrency upon which the application depends.
101Library developers are advised to not use the
102.Fn pthread_getconcurrency
103and
104.Fn pthread_setconcurrency
105functions since their use may conflict with an application's
106use of these functions.
107.Sh STANDARDS
108The
109.Fn pthread_getconcurrency
110and
111.Fn pthread_setconcurrency
112functions conform to
113.St -susv2 .
114