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