xref: /freebsd/share/man/man3/pthread_getconcurrency.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
18c0d4b5fSJohn Polstra.\" Copyright (c) 2003 Sergey Osokin <osa@FreeBSD.org.ru>
28c0d4b5fSJohn Polstra.\" All rights reserved.
38c0d4b5fSJohn Polstra.\"
48c0d4b5fSJohn Polstra.\" Redistribution and use in source and binary forms, with or without
58c0d4b5fSJohn Polstra.\" modification, are permitted provided that the following conditions
68c0d4b5fSJohn Polstra.\" are met:
78c0d4b5fSJohn Polstra.\" 1. Redistributions of source code must retain the above copyright
88c0d4b5fSJohn Polstra.\"    notice, this list of conditions and the following disclaimer.
98c0d4b5fSJohn Polstra.\" 2. Redistributions in binary form must reproduce the above copyright
108c0d4b5fSJohn Polstra.\"    notice, this list of conditions and the following disclaimer in the
118c0d4b5fSJohn Polstra.\"    documentation and/or other materials provided with the distribution.
128c0d4b5fSJohn Polstra.\"
138c0d4b5fSJohn Polstra.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
148c0d4b5fSJohn Polstra.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
158c0d4b5fSJohn Polstra.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
168c0d4b5fSJohn Polstra.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
178c0d4b5fSJohn Polstra.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
188c0d4b5fSJohn Polstra.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
198c0d4b5fSJohn Polstra.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
208c0d4b5fSJohn Polstra.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
218c0d4b5fSJohn Polstra.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
228c0d4b5fSJohn Polstra.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
238c0d4b5fSJohn Polstra.\" SUCH DAMAGE.
248c0d4b5fSJohn Polstra.Dd April 11, 2003
258c0d4b5fSJohn Polstra.Dt PTHREAD_GETCONCURRENCY 3
268c0d4b5fSJohn Polstra.Os
278c0d4b5fSJohn Polstra.Sh NAME
288c0d4b5fSJohn Polstra.Nm pthread_getconcurrency ,
298c0d4b5fSJohn Polstra.Nm pthread_setconcurrency
308c0d4b5fSJohn Polstra.Nd get or set level of concurrency
318c0d4b5fSJohn Polstra.Sh LIBRARY
32ec7452f1SRuslan Ermilov.Lb libpthread
338c0d4b5fSJohn Polstra.Sh SYNOPSIS
348c0d4b5fSJohn Polstra.In pthread.h
358c0d4b5fSJohn Polstra.Ft int
36734ac3b5SRuslan Ermilov.Fn pthread_getconcurrency void
378c0d4b5fSJohn Polstra.Ft int
388c0d4b5fSJohn Polstra.Fn pthread_setconcurrency "int new_level"
398c0d4b5fSJohn Polstra.Sh DESCRIPTION
408c0d4b5fSJohn PolstraThe
41*c2ed16b2SHiren Panchasara.Fn pthread_setconcurrency
428c0d4b5fSJohn Polstrafunction allows an application to inform the threads implementation
438c0d4b5fSJohn Polstraof its desired concurrency level,
44734ac3b5SRuslan Ermilov.Fa new_level .
458c0d4b5fSJohn PolstraThe actual level of concurrency provided by the implementation
46734ac3b5SRuslan Ermilovas a result of this function call is unspecified.
47734ac3b5SRuslan ErmilovIf
48734ac3b5SRuslan Ermilov.Fa new_level
49734ac3b5SRuslan Ermilovis zero, it causes the implementation to maintain the concurrency
508c0d4b5fSJohn Polstralevel at its discretion as if
518c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
52734ac3b5SRuslan Ermilovwas never called.
53734ac3b5SRuslan ErmilovThe
548c0d4b5fSJohn Polstra.Fn pthread_getconcurrency
558c0d4b5fSJohn Polstrafunction returns the value set by a previous call to the
568c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
57734ac3b5SRuslan Ermilovfunction.
58734ac3b5SRuslan ErmilovIf the
598c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
608c0d4b5fSJohn Polstrafunction was not previously called, this function returns zero to
618c0d4b5fSJohn Polstraindicate that the implementation is maintaining the concurrency
62734ac3b5SRuslan Ermilovlevel.
63734ac3b5SRuslan ErmilovWhen an application calls
64734ac3b5SRuslan Ermilov.Fn pthread_setconcurrency ,
658c0d4b5fSJohn Polstrait is informing the implementation of its desired concurrency
66734ac3b5SRuslan Ermilovlevel.
67734ac3b5SRuslan ErmilovThe implementation uses this as a hint, not a requirement.
688c0d4b5fSJohn Polstra.Sh RETURN VALUES
698c0d4b5fSJohn PolstraIf successful, the
708c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
71734ac3b5SRuslan Ermilovfunction returns zero.
72734ac3b5SRuslan ErmilovOtherwise, an error number is returned
73734ac3b5SRuslan Ermilovto indicate the error.
74734ac3b5SRuslan ErmilovThe
758c0d4b5fSJohn Polstra.Fn pthread_getconcurrency
768c0d4b5fSJohn Polstrafunction always returns the concurrency level set by a previous
778c0d4b5fSJohn Polstracall to
788c0d4b5fSJohn Polstra.Fn pthread_setconcurrency .
798c0d4b5fSJohn PolstraIf the
808c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
818c0d4b5fSJohn Polstrafunction has never been called,
828c0d4b5fSJohn Polstra.Fn pthread_getconcurrency
838c0d4b5fSJohn Polstrareturns zero.
848c0d4b5fSJohn Polstra.Sh ERRORS
858c0d4b5fSJohn PolstraThe
868c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
878c0d4b5fSJohn Polstrafunction will fail if:
888c0d4b5fSJohn Polstra.Bl -tag -width Er
898c0d4b5fSJohn Polstra.It Bq Er EINVAL
908c0d4b5fSJohn PolstraThe value specified by
91734ac3b5SRuslan Ermilov.Fa new_level
928c0d4b5fSJohn Polstrais negative.
938c0d4b5fSJohn Polstra.It Bq Er EAGAIN
94734ac3b5SRuslan ErmilovThe value specified by
95734ac3b5SRuslan Ermilov.Fa new_level
968c0d4b5fSJohn Polstrawould cause a system resource to be exceeded.
978c0d4b5fSJohn Polstra.El
988c0d4b5fSJohn Polstra.Sh APPLICATION USAGE
998c0d4b5fSJohn PolstraUse of these functions changes the state of the underlying
100734ac3b5SRuslan Ermilovconcurrency upon which the application depends.
101734ac3b5SRuslan ErmilovLibrary developers are advised to not use the
1028c0d4b5fSJohn Polstra.Fn pthread_getconcurrency
1038c0d4b5fSJohn Polstraand
1048c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
105734ac3b5SRuslan Ermilovfunctions since their use may conflict with an application's
1068c0d4b5fSJohn Polstrause of these functions.
1078c0d4b5fSJohn Polstra.Sh STANDARDS
1088c0d4b5fSJohn PolstraThe
1098c0d4b5fSJohn Polstra.Fn pthread_getconcurrency
1108c0d4b5fSJohn Polstraand
1118c0d4b5fSJohn Polstra.Fn pthread_setconcurrency
1128c0d4b5fSJohn Polstrafunctions conform to
113734ac3b5SRuslan Ermilov.St -susv2 .
114