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