Have a single set of POSIX threads man pages. The LIBRARY section

of each manpage lists libraries that have corresponding interfaces
implemented.

Prodded by:	threads
Reviewed by:	deischen
This commit is contained in:
Ruslan Ermilov 2004-01-14 21:44:26 +00:00
parent 5df3ca789c
commit ec7452f103
158 changed files with 154 additions and 9666 deletions

View File

@ -22,7 +22,6 @@ CFLAGS+=-D_PTHREADS_INVARIANTS
PRECIOUSLIB= yes
.include "${.CURDIR}/man/Makefile.inc"
.include "${.CURDIR}/uthread/Makefile.inc"
.include "${.CURDIR}/sys/Makefile.inc"

View File

@ -1,101 +0,0 @@
# $FreeBSD$
# POSIX thread man files
.PATH: ${.CURDIR}/man
MAN+= pthread_attr.3 \
pthread_attr_get_np.3 \
pthread_attr_setcreatesuspend_np.3 \
pthread_cancel.3 \
pthread_cleanup_pop.3 \
pthread_cleanup_push.3 \
pthread_getconcurrency.3 \
pthread_condattr.3 \
pthread_cond_broadcast.3 \
pthread_cond_destroy.3 \
pthread_cond_init.3 \
pthread_cond_signal.3 \
pthread_cond_timedwait.3 \
pthread_cond_wait.3 \
pthread_create.3 \
pthread_detach.3 \
pthread_equal.3 \
pthread_exit.3 \
pthread_getspecific.3 \
pthread_join.3 \
pthread_key_create.3 \
pthread_key_delete.3 \
pthread_kill.3 \
pthread_main_np.3 \
pthread_multi_np.3 \
pthread_mutexattr.3 \
pthread_mutexattr_getkind_np.3 \
pthread_mutex_destroy.3 \
pthread_mutex_init.3 \
pthread_mutex_lock.3 \
pthread_mutex_trylock.3 \
pthread_mutex_unlock.3 \
pthread_once.3 \
pthread_resume_all_np.3 \
pthread_resume_np.3 \
pthread_rwlock_destroy.3 \
pthread_rwlock_init.3 \
pthread_rwlock_rdlock.3 \
pthread_rwlock_unlock.3 \
pthread_rwlock_wrlock.3 \
pthread_rwlockattr_destroy.3 \
pthread_rwlockattr_getpshared.3 \
pthread_rwlockattr_init.3 \
pthread_rwlockattr_setpshared.3 \
pthread_schedparam.3 \
pthread_self.3 \
pthread_set_name_np.3 \
pthread_setspecific.3 \
pthread_sigmask.3 \
pthread_suspend_all_np.3 \
pthread_suspend_np.3 \
pthread_switch_add_np.3 \
pthread_testcancel.3
MLINKS+= \
pthread_attr.3 pthread_attr_destroy.3 \
pthread_attr.3 pthread_attr_getdetachstate.3 \
pthread_attr.3 pthread_attr_getguardsize.3 \
pthread_attr.3 pthread_attr_getinheritsched.3 \
pthread_attr.3 pthread_attr_getschedparam.3 \
pthread_attr.3 pthread_attr_getschedpolicy.3 \
pthread_attr.3 pthread_attr_getscope.3 \
pthread_attr.3 pthread_attr_getstack.3 \
pthread_attr.3 pthread_attr_getstackaddr.3 \
pthread_attr.3 pthread_attr_getstacksize.3 \
pthread_attr.3 pthread_attr_init.3 \
pthread_attr.3 pthread_attr_setdetachstate.3 \
pthread_attr.3 pthread_attr_setguardsize.3 \
pthread_attr.3 pthread_attr_setinheritsched.3 \
pthread_attr.3 pthread_attr_setschedparam.3 \
pthread_attr.3 pthread_attr_setschedpolicy.3 \
pthread_attr.3 pthread_attr_setscope.3 \
pthread_attr.3 pthread_attr_setstack.3 \
pthread_attr.3 pthread_attr_setstackaddr.3 \
pthread_attr.3 pthread_attr_setstacksize.3 \
pthread_getconcurrency.3 pthread_setconcurrency.3 \
pthread_condattr.3 pthread_condattr_init.3 \
pthread_condattr.3 pthread_condattr_destroy.3 \
pthread_multi_np.3 pthread_single_np.3 \
pthread_mutexattr.3 pthread_mutexattr_init.3 \
pthread_mutexattr.3 pthread_mutexattr_destroy.3 \
pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3 \
pthread_mutexattr.3 pthread_mutexattr_getprotocol.3 \
pthread_mutexattr.3 pthread_mutexattr_gettype.3 \
pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3 \
pthread_mutexattr.3 pthread_mutexattr_setprotocol.3 \
pthread_mutexattr.3 pthread_mutexattr_settype.3 \
pthread_mutexattr_getkind_np.3 pthread_mutexattr_setkind_np.3 \
pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 \
pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 \
pthread_schedparam.3 pthread_getschedparam.3 \
pthread_schedparam.3 pthread_setschedparam.3 \
pthread_switch_add_np.3 pthread_switch_delete_np.3 \
pthread_testcancel.3 pthread_setcancelstate.3 \
pthread_testcancel.3 pthread_setcanceltype.3

View File

@ -1,238 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 28, 2000
.Dt PTHREAD_ATTR 3
.Os
.Sh NAME
.Nm pthread_attr_init ,
.Nm pthread_attr_destroy ,
.Nm pthread_attr_setstack ,
.Nm pthread_attr_getstack ,
.Nm pthread_attr_setstacksize ,
.Nm pthread_attr_getstacksize ,
.Nm pthread_attr_setguardsize ,
.Nm pthread_attr_getguardsize ,
.Nm pthread_attr_setstackaddr ,
.Nm pthread_attr_getstackaddr ,
.Nm pthread_attr_setdetachstate ,
.Nm pthread_attr_getdetachstate ,
.Nm pthread_attr_setinheritsched ,
.Nm pthread_attr_getinheritsched ,
.Nm pthread_attr_setschedparam ,
.Nm pthread_attr_getschedparam ,
.Nm pthread_attr_setschedpolicy ,
.Nm pthread_attr_getschedpolicy ,
.Nm pthread_attr_setscope ,
.Nm pthread_attr_getscope
.Nd thread attribute operations
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_init "pthread_attr_t *attr"
.Ft int
.Fn pthread_attr_destroy "pthread_attr_t *attr"
.Ft int
.Fn pthread_attr_setstack "pthread_attr_t *attr" " void *stackaddr" "size_t stacksize"
.Ft int
.Fn pthread_attr_getstack "const pthread_attr_t * restrict attr" "void ** restrict stackaddr" "size_t * restrict stacksize"
.Ft int
.Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
.Ft int
.Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
.Ft int
.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
.Ft int
.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
.Ft int
.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
.Ft int
.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
.Ft int
.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
.Ft int
.Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
.Ft int
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
.Ft int
.Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched"
.Ft int
.Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param"
.Ft int
.Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param"
.Ft int
.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
.Ft int
.Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
.Ft int
.Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
.Ft int
.Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .
One attribute object can be used in multiple calls to
.Fn pthread_create ,
with or without modifications between calls.
.Pp
The
.Fn pthread_attr_init
function initializes
.Fa attr
with all the default thread attributes.
.Pp
The
.Fn pthread_attr_destroy
function destroys
.Fa attr .
.Pp
The
.Fn pthread_attr_set*
functions set the attribute that corresponds to each function name.
.Pp
The
.Fn pthread_attr_get*
functions copy the value of the attribute that corresponds to each function name
to the location pointed to by the second function parameter.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_attr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_attr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_attr_setstacksize
and
.Fn pthread_attr_setstack
functions will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa stacksize
is less than
.Dv PTHREAD_STACK_MIN .
.El
.Pp
The
.Fn pthread_attr_setdetachstate
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa detachstate .
.El
.Pp
The
.Fn pthread_attr_setinheritsched
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_attr_setschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid value for
.Fa param .
.El
.Pp
The
.Fn pthread_attr_setschedpolicy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid or unsupported value for
.Fa policy .
.El
.Pp
The
.Fn pthread_attr_setscope
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid or unsupported value for
.Fa contentionscope .
.El
.Sh SEE ALSO
.Xr pthread_attr_get_np 3 ,
.Xr pthread_create 3
.Sh STANDARDS
The
.Fn pthread_attr_init ,
.Fn pthread_attr_destroy ,
.Fn pthread_attr_setstacksize ,
.Fn pthread_attr_getstacksize ,
.Fn pthread_attr_setstackaddr ,
.Fn pthread_attr_getstackaddr ,
.Fn pthread_attr_setdetachstate ,
and
.Fn pthread_attr_getdetachstate
functions conform to
.St -p1003.1-96
.Pp
The
.Fn pthread_attr_setinheritsched ,
.Fn pthread_attr_getinheritsched ,
.Fn pthread_attr_setschedparam ,
.Fn pthread_attr_getschedparam ,
.Fn pthread_attr_setschedpolicy ,
.Fn pthread_attr_getschedpolicy ,
.Fn pthread_attr_setscope ,
and
.Fn pthread_attr_getscope
functions conform to
.St -susv2

View File

@ -1,116 +0,0 @@
.\" Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 31, 2003
.Dt PTHREAD_ATTR_GET_NP 3
.Os
.Sh NAME
.Nm pthread_attr_get_np
.Nd get attributes of existent thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_attr_get_np "pthread_t pid" "pthread_attr_t *dst"
.Sh DESCRIPTION
The
.Fn pthread_attr_get_np
function is used to get existent thread's attributes.
Most fields of
.Vt pthread_attr_t
structure are exact values of attributes provided at thread creation
time (as parameter to
.Xr pthread_create 3
function), except for the stack address.
.Pp
Value returned as
.Fa dst
is supposed to be used in conjunction with
.Fn pthread_attr_get*
functions to retrieve individual values from
.Vt pthread_attr_t
structure.
Parameter
.Fa dst
should point to allocated memory area big enough to fit this structure.
.Pp
It is HIGHLY RECOMMENDED to use
.Xr pthread_attr_init 3
function to allocate attribute storage.
.Sh IMPLEMENTATION NOTES
The
.Fn pthread_attr_get_np
function will always return a pointer to the thread's real stack address,
regardless of its value in the original attributes structure.
.Sh EXAMPLES
.Bd -literal
size_t
my_thread_stack_size(pthread_t pid)
{
pthread_attr_t attr;
size_t size;
pthread_attr_init(&attr);
pthread_attr_get_np(pid, &attr);
pthread_attr_getstacksize(&attr, &size);
pthread_attr_destroy(&attr);
return(size);
}
.Ed
.Sh RETURN VALUES
If successful,
.Fn pthread_attr_get_np
function returns 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_attr_get_np
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for one of given parameters.
.It Bq Er ESRC
No thread could be found corresponding to that specified by the given
thread ID.
.El
.Sh SEE ALSO
.Xr pthread_attr_destroy 3 ,
.Xr pthread_attr_getdetachstate 3 ,
.Xr pthread_attr_getinheritsched 3 ,
.Xr pthread_attr_getschedparam 3 ,
.Xr pthread_attr_getschedpolicy 3 ,
.Xr pthread_attr_getscope 3 ,
.Xr pthread_attr_getstack 3 ,
.Xr pthread_attr_getstackaddr 3 ,
.Xr pthread_attr_getstacksize 3 ,
.Xr pthread_attr_init 3
.Sh AUTHORS
The
.Fn pthread_attr_get_np
function and this manual page were written by
.An Alexey Zelkin
.Aq phantom@FreeBSD.org .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_ATTR_SETCREATESUSPEND_NP 3
.Os
.Sh NAME
.Nm pthread_attr_setcreatesuspend_np
.Nd prepare attribute for creattion of suspended thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_attr_setcreatesuspend_np
instructs
.Xr pthread_create 3
that the thread created with the
.Fa attr
attribute
should be created and left in a suspended state until explicitly resumed
by the call to
.Fn pthread_resume_np
or
.Fn pthread_resume_all_np .
.Sh RETURN VALUES
.Rv -std pthread_attr_setcreatesuspend_np
.Sh ERRORS
The
.Fn pthread_attr_setcreatesuspend_np
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_attr_destroy 3 ,
.Xr pthread_attr_init 3 ,
.Xr pthread_create 3 ,
.Xr pthread_resume_all_np 3 ,
.Xr pthread_resume_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,81 +0,0 @@
.\" $FreeBSD$
.Dd January 17, 1999
.Dt PTHREAD_CANCEL 3
.Os
.Sh NAME
.Nm pthread_cancel
.Nd cancel execution of a thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cancel "pthread_t thread"
.Sh DESCRIPTION
The
.Fn pthread_cancel
function requests that
.Fa thread
be canceled.
The target thread's cancelability state and type determines
when the cancellation takes effect.
When the cancellation is acted on,
the cancellation cleanup handlers for
.Fa thread
are called.
When the last cancellation cleanup handler returns,
the thread-specific data destructor functions will be called for
.Fa thread .
When the last destructor function returns,
.Fa thread
will be terminated.
.Pp
The cancellation processing in the target thread runs asynchronously with
respect to the calling thread returning from
.Fn pthread_cancel .
.Pp
A status of
.Dv PTHREAD_CANCELED
is made available to any threads joining with the target.
The symbolic
constant
.Dv PTHREAD_CANCELED
expands to a constant expression of type
.Ft "(void *)" ,
whose value matches no pointer to an object in memory nor the value
.Dv NULL .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cancel
functions will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cancel
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID.
.El
.Sh SEE ALSO
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3 ,
.Xr pthread_join 3 ,
.Xr pthread_setcancelstate 3 ,
.Xr pthread_setcanceltype 3 ,
.Xr pthread_testcancel 3
.Sh STANDARDS
The
.Fn pthread_cancel
function conforms to
.St -p1003.1-96 .
.Sh AUTHORS
This man page was written by
.An David Leonard Aq d@openbsd.org
for the
.Ox
implementation of
.Fn pthread_cancel .

View File

@ -1,66 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_CLEANUP_POP 3
.Os
.Sh NAME
.Nm pthread_cleanup_pop
.Nd call the first cleanup routine
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_cleanup_pop "int execute"
.Sh DESCRIPTION
The
.Fn pthread_cleanup_pop
function pops the top cleanup routine off of the current threads cleanup
routine stack, and, if
.Fa execute
is non-zero, it will execute the function.
If there is no cleanup routine
then
.Fn pthread_cleanup_pop
does nothing.
.Sh RETURN VALUES
The
.Fn pthread_cleanup_pop
function does not return any value.
.Sh ERRORS
None
.Sh SEE ALSO
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_cleanup_pop
function conforms to
.St -p1003.1-96 .

View File

@ -1,68 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_CLEANUP_PUSH 3
.Os
.Sh NAME
.Nm pthread_cleanup_push
.Nd add a cleanup function for thread exit
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_cleanup_push "void \*[lp]*cleanup_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
.Sh DESCRIPTION
The
.Fn pthread_cleanup_push
function adds
.Fa cleanup_routine
to the top of the stack of cleanup handlers that
get called when the current thread exits.
.Pp
When
.Fa cleanup_routine
is called, it is passed
.Fa arg
as its only argument.
.Sh RETURN VALUES
The
.Fn pthread_cleanup_push
function does not return any value.
.Sh ERRORS
None
.Sh SEE ALSO
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_cleanup_push
function conforms to
.St -p1003.1-96 .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_BROADCAST 3
.Os
.Sh NAME
.Nm pthread_cond_broadcast
.Nd unblock all threads waiting for a condition variable
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_broadcast "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_broadcast
function unblocks all threads waiting for the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_broadcast
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_broadcast
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_broadcast
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_DESTROY 3
.Os
.Sh NAME
.Nm pthread_cond_destroy
.Nd destroy a condition variable
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_destroy "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_destroy
function frees the resources allocated by the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_destroy
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.It Bq Er EBUSY
The variable
.Fa cond
is locked by another thread.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_destroy
function conforms to
.St -p1003.1-96 .

View File

@ -1,82 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_INIT 3
.Os
.Sh NAME
.Nm pthread_cond_init
.Nd create a condition variable
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_init "pthread_cond_t *cond" "const pthread_condattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_cond_init
function creates a new condition variable, with attributes specified with
.Fa attr .
If
.Fa attr
is NULL the default attributes are used.
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_init
function will return zero and put the new condition variable id into
.Fa cond ,
otherwise an error number will be returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.It Bq Er ENOMEM
The process cannot allocate enough memory to create another condition
variable.
.It Bq Er EAGAIN
The system temporarily lacks the resources to create another condition
variable.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_init
function conforms to
.St -p1003.1-96 .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_SIGNAL 3
.Os
.Sh NAME
.Nm pthread_cond_signal
.Nd unblock a thread waiting for a condition variable
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_signal "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_signal
function unblocks one thread waiting for the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_signal
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_signal
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_signal
function conforms to
.St -p1003.1-96 .

View File

@ -1,91 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_TIMEDWAIT 3
.Os
.Sh NAME
.Nm pthread_cond_timedwait
.Nd "wait on a condition variable for a specific amount of time"
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_timedwait "pthread_cond_t *cond" "pthread_mutex_t *mutex" "const struct timespec *abstime"
.Sh DESCRIPTION
The
.Fn pthread_cond_timedwait
function atomically blocks the current thread waiting on the condition
variable specified by
.Fa cond ,
and unblocks the mutex specified by
.Fa mutex .
The waiting thread unblocks only after another thread calls
.Xr pthread_cond_signal 3 ,
or
.Xr pthread_cond_broadcast 3
with the same condition variable, or if the system time reaches the
time specified in
.Fa abstime ,
and the current thread reacquires the lock on
.Fa mutex .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_timedwait
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_timedwait
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond ,
.Fa mutex
or
.Fa abstime
is invalid.
.It Bq Er ETIMEDOUT
The system time has reached or exceeded the time specified in
.Fa abstime .
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_timedwait
function conforms to
.St -p1003.1-96 .

View File

@ -1,85 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_WAIT 3
.Os
.Sh NAME
.Nm pthread_cond_wait
.Nd wait on a condition variable
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_wait "pthread_cond_t *cond" "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_cond_wait
function atomically blocks the current thread waiting on the condition
variable specified by
.Fa cond ,
and unblocks the mutex specified by
.Fa mutex .
The waiting thread unblocks only after another thread calls
.Xr pthread_cond_signal 3 ,
or
.Xr pthread_cond_broadcast 3
with the same condition variable, and the current thread reacquires the lock
on
.Fa mutex .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_wait
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_wait
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
or the value specified by
.Fa mutex
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3
.Sh STANDARDS
The
.Fn pthread_cond_wait
function conforms to
.St -p1003.1-96 .

View File

@ -1,88 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 28, 2000
.Dt PTHREAD_CONDATTR 3
.Os
.Sh NAME
.Nm pthread_condattr_init ,
.Nm pthread_condattr_destroy
.Nd condition attribute operations
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_condattr_init "pthread_condattr_t *attr"
.Ft int
.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
.Sh DESCRIPTION
Condition attribute objects are used to specify parameters to
.Fn pthread_cond_init .
.Fx Ns 's
implementation of conditions does not support any non-default
attributes, so these functions are not very useful, though they are required
to be present by
.Tn POSIX .
.Pp
The
.Fn pthread_condattr_init
function initializes a condition attribute object with the default attributes.
.Pp
The
.Fn pthread_condattr_destroy
function destroys a condition attribute object.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_condattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_condattr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Sh SEE ALSO
.Xr pthread_cond_init 3
.Sh STANDARDS
The
.Fn pthread_condattr_init
and
.Fn pthread_condattr_destroy
functions conform to
.St -p1003.1-96

View File

@ -1,125 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_CREATE 3
.Os
.Sh NAME
.Nm pthread_create
.Nd create a new thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_create "pthread_t *thread" "const pthread_attr_t *attr" "void *(*start_routine)(void *)" "void *arg"
.Sh DESCRIPTION
The
.Fn pthread_create
function is used to create a new thread, with attributes specified by
.Fa attr ,
within a process.
If
.Fa attr
is
.Dv NULL ,
the default attributes are used.
If the attributes specified by
.Fa attr
are modified later, the thread's attributes are not affected.
Upon
successful completion
.Fn pthread_create
will store the ID of the created thread in the location specified by
.Fa thread .
.Pp
The thread is created executing
.Fa start_routine
with
.Fa arg
as its sole argument.
If the
.Fa start_routine
returns, the effect is as if there was an implicit call to
.Fn pthread_exit
using the return value of
.Fa start_routine
as the exit status.
Note that the thread in which
.Fn main
was originally invoked differs from this.
When it returns from
.Fn main ,
the effect is as if there was an implicit call to
.Fn exit
using the return value of
.Fn main
as the exit status.
.Pp
The signal state of the new thread is initialized as:
.Bl -bullet -offset indent
.It
The signal mask is inherited from the creating thread.
.It
The set of signals pending for the new thread is empty.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_create
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_create
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources to create another thread, or
the system-imposed limit on the total number of threads in a process
[PTHREAD_THREADS_MAX] would be exceeded.
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh SEE ALSO
.Xr fork 2 ,
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3 ,
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_create
function conforms to
.St -p1003.1-96 .

View File

@ -1,91 +0,0 @@
.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_DETACH 3
.Os
.Sh NAME
.Nm pthread_detach
.Nd detach a thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_detach "pthread_t thread"
.Sh DESCRIPTION
The
.Fn pthread_detach
function is used to indicate to the implementation that storage for the
thread
.Fa thread
can be reclaimed when the thread terminates.
If
.Fa thread
has not terminated,
.Fn pthread_detach
will not cause it to terminate.
The effect of multiple
.Fn pthread_detach
calls on the same target thread is unspecified.
.Sh RETURN VALUES
If successful, the
.Fn pthread_detach
function will return zero.
Otherwise an error number will be returned to
indicate the error.
Note that the function does not change the value
of errno as it did for some drafts of the standard.
These early drafts
also passed a pointer to pthread_t as the argument.
Beware!
.Sh ERRORS
The
.Fn pthread_detach
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The implementation has detected that the value specified by
.Fa thread
does not refer to a joinable thread.
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID,
.Fa thread .
.El
.Sh SEE ALSO
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_detach
function conforms to
.St -p1003.1-96 .

View File

@ -1,69 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_EQUAL 3
.Os
.Sh NAME
.Nm pthread_equal
.Nd compare thread IDs
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_equal "pthread_t t1" "pthread_t t2"
.Sh DESCRIPTION
The
.Fn pthread_equal
function compares the thread IDs
.Fa t1
and
.Fa t2 .
.Sh RETURN VALUES
The
.Fn pthread_equal
function will return non-zero if the thread IDs
.Fa t1
and
.Fa t2
correspond to the same thread, otherwise it will return zero.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_equal
function conforms to
.St -p1003.1-96 .

View File

@ -1,105 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_EXIT 3
.Os
.Sh NAME
.Nm pthread_exit
.Nd terminate the calling thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_exit "void *value_ptr"
.Sh DESCRIPTION
The
.Fn pthread_exit
function terminates the calling thread and makes the value
.Fa value_ptr
available to any successful join with the terminating thread.
Any
cancellation cleanup handlers that have been pushed and are not yet popped
are popped in the reverse order that they were pushed and then executed.
After all cancellation handlers have been executed, if the thread has any
thread-specific data, appropriate destructor functions are called in an
unspecified order.
Thread termination does not release any application
visible process resources, including, but not limited to, mutexes and
file descriptors, nor does it perform any process level cleanup
actions, including, but not limited to, calling
.Fn atexit
routines that may exist.
.Pp
An implicit call to
.Fn pthread_exit
is made when a thread other than the thread in which
.Fn main
was first invoked returns from the start routine that was used to create
it. The function's return value serves as the thread's exit status.
.Pp
The behavior of
.Fn pthread_exit
is undefined if called from a cancellation handler or destructor function
that was invoked as the result of an implicit or explicit call to
.Fn pthread_exit .
.Pp
After a thread has terminated, the result of access to local (auto)
variables of the thread is undefined.
Thus, references to local variables
of the exiting thread should not be used for the
.Fn pthread_exit
.Fa value_ptr
parameter value.
.Pp
The process will exit with an exit status of 0 after the last thread has
been terminated.
The behavior is as if the implementation called
.Fn exit
with a zero argument at thread termination time.
.Sh RETURN VALUES
The
.Fn pthread_exit
function cannot return to its caller.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr _exit 2 ,
.Xr exit 3 ,
.Xr pthread_create 3 ,
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_exit
function conforms to
.St -p1003.1-96 .

View File

@ -1,115 +0,0 @@
.\" Copyright (c) 2003 Sergey Osokin <osa@FreeBSD.org.ru>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 11, 2003
.Dt PTHREAD_GETCONCURRENCY 3
.Os
.Sh NAME
.Nm pthread_getconcurrency ,
.Nm pthread_setconcurrency
.Nd get or set level of concurrency
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_getconcurrency void
.Ft int
.Fn pthread_setconcurrency "int new_level"
.Sh DESCRIPTION
The
.Fn pthread_getconcurrency
function allows an application to inform the threads implementation
of its desired concurrency level,
.Fa new_level .
The actual level of concurrency provided by the implementation
as a result of this function call is unspecified.
If
.Fa new_level
is zero, it causes the implementation to maintain the concurrency
level at its discretion as if
.Fn pthread_setconcurrency
was never called.
The
.Fn pthread_getconcurrency
function returns the value set by a previous call to the
.Fn pthread_setconcurrency
function.
If the
.Fn pthread_setconcurrency
function was not previously called, this function returns zero to
indicate that the implementation is maintaining the concurrency
level.
When an application calls
.Fn pthread_setconcurrency ,
it is informing the implementation of its desired concurrency
level.
The implementation uses this as a hint, not a requirement.
.Sh RETURN VALUES
If successful, the
.Fn pthread_setconcurrency
function returns zero.
Otherwise, an error number is returned
to indicate the error.
The
.Fn pthread_getconcurrency
function always returns the concurrency level set by a previous
call to
.Fn pthread_setconcurrency .
If the
.Fn pthread_setconcurrency
function has never been called,
.Fn pthread_getconcurrency
returns zero.
.Sh ERRORS
The
.Fn pthread_setconcurrency
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa new_level
is negative.
.It Bq Er EAGAIN
The value specified by
.Fa new_level
would cause a system resource to be exceeded.
.El
.Sh APPLICATION USAGE
Use of these functions changes the state of the underlying
concurrency upon which the application depends.
Library developers are advised to not use the
.Fn pthread_getconcurrency
and
.Fn pthread_setconcurrency
functions since their use may conflict with an application's
use of these functions.
.Sh STANDARDS
The
.Fn pthread_getconcurrency
and
.Fn pthread_setconcurrency
functions conform to
.St -susv2 .

View File

@ -1,85 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_GETSPECIFIC 3
.Os
.Sh NAME
.Nm pthread_getspecific
.Nd get a thread-specific data value
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft void *
.Fn pthread_getspecific "pthread_key_t key"
.Sh DESCRIPTION
The
.Fn pthread_getspecific
function returns the value currently bound to the specified
.Fa key
on behalf of the calling thread.
.Pp
The effect of calling
.Fn pthread_getspecific
with a
.Fa key
value not obtained from
.Fn pthread_key_create
or after
.Fa key
has been deleted with
.Fn pthread_key_delete
is undefined.
.Pp
The
.Fn pthread_getspecific
function may be called from a thread-specific data destructor function.
.Sh RETURN VALUES
The
.Fn pthread_getspecific
function will return the thread-specific data value associated with the given
.Fa key .
If no thread-specific data value is associated with
.Fa key ,
then the value NULL is returned.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_key_create 3 ,
.Xr pthread_key_delete 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_getspecific
function conforms to
.St -p1003.1-96 .

View File

@ -1,106 +0,0 @@
.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_JOIN 3
.Os
.Sh NAME
.Nm pthread_join
.Nd wait for thread termination
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_join "pthread_t thread" "void **value_ptr"
.Sh DESCRIPTION
The
.Fn pthread_join
function suspends execution of the calling thread until the target
.Fa thread
terminates unless the target
.Fa thread
has already terminated.
.Pp
On return from a successful
.Fn pthread_join
call with a non-NULL
.Fa value_ptr
argument, the value passed to
.Fn pthread_exit
by the terminating thread is stored in the location referenced by
.Fa value_ptr .
When a
.Fn pthread_join
returns successfully, the target thread has been terminated.
The results
of multiple simultaneous calls to
.Fn pthread_join
specifying the same target thread are undefined.
If the thread calling
.Fn pthread_join
is cancelled, then the target thread is not detached.
.Pp
A thread that has exited but remains unjoined counts against
[_POSIX_THREAD_THREADS_MAX].
.Sh RETURN VALUES
If successful, the
.Fn pthread_join
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_join
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The implementation has detected that the value specified by
.Fa thread
does not refer to a joinable thread.
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID,
.Fa thread .
.It Bq Er EDEADLK
A deadlock was detected or the value of
.Fa thread
specifies the calling thread.
.El
.Sh SEE ALSO
.Xr wait 2 ,
.Xr pthread_create 3
.Sh STANDARDS
The
.Fn pthread_join
function conforms to
.St -p1003.1-96 .

View File

@ -1,109 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_KEY_CREATE 3
.Os
.Sh NAME
.Nm pthread_key_create
.Nd thread-specific data key creation
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_key_create "pthread_key_t *key" "void (*destructor)(void *)"
.Sh DESCRIPTION
The
.Fn pthread_key_create
function creates a thread-specific data key visible to all threads in the
process.
Key values provided by
.Fn pthread_key_create
are opaque objects used to locate thread-specific data.
Although the same
key value may be used by different threads, the values bound to the key
by
.Fn pthread_setspecific
are maintained on a per-thread basis and persist for the life of the calling
thread.
.Pp
Upon key creation, the value NULL is associated with the new key in all
active threads.
Upon thread creation, the value NULL is associated with all
defined keys in the new thread.
.Pp
An optional destructor function may be associated with each key value.
At
thread exit, if a key value has a non-NULL destructor pointer, and the
thread has a non-NULL value associated with the key, the function pointed
to is called with the current associated value as its sole argument.
The
order of destructor calls is unspecified if more than one destructor exists
for a thread when it exits.
.Pp
If, after all the destructors have been called for all non-NULL values
with associated destructors, there are still some non-NULL values with
associated destructors, then the process is repeated.
If, after at least
[PTHREAD_DESTRUCTOR_ITERATIONS] iterations of destructor calls for
outstanding non-NULL values, there are still some non-NULL values with
associated destructors, the implementation stops calling destructors.
.Sh RETURN VALUES
If successful, the
.Fn pthread_key_create
function will store the newly created key value at the location specified by
.Fa key
and returns zero.
Otherwise an error number will be returned to indicate
the error.
.Sh ERRORS
The
.Fn pthread_key_create
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources to create another thread-specific
data key, or the system-imposed limit on the total number of keys per process
[PTHREAD_KEYS_MAX] would be exceeded.
.It Bq Er ENOMEM
Insufficient memory exists to create the key.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_delete 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_key_create
function conforms to
.St -p1003.1-96 .

View File

@ -1,100 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_KEY_DELETE 3
.Os
.Sh NAME
.Nm pthread_key_delete
.Nd delete a thread-specific data key
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_key_delete "pthread_key_t key"
.Sh DESCRIPTION
The
.Fn pthread_key_delete
function deletes a thread-specific data key previously returned by
.Fn pthread_key_create .
The thread-specific data values associated with
.Fa key
need not be NULL at the time that
.Fn pthread_key_delete
is called.
It is the responsibility of the application to free any
application storage or perform any cleanup actions for data structures
related to the deleted key or associated thread-specific data in any threads;
this cleanup can be done either before or after
.Fn pthread_key_delete
is called.
Any attempt to use
.Fa key
following the call to
.Fn pthread_key_delete
results in undefined behavior.
.Pp
The
.Fn pthread_key_delete
function is callable from within destructor functions.
Destructor functions
are not invoked by
.Fn pthread_key_delete .
Any destructor function that may have been associated with
.Fa key
will no longer be called upon thread exit.
.Sh RETURN VALUES
If successful, the
.Fn pthread_key_delete
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_key_delete
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa key
value is invalid.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_create 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_key_delete
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 27, 2000
.Dt PTHREAD_KILL 3
.Os
.Sh NAME
.Nm pthread_kill
.Nd send a signal to a specified thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.In signal.h
.Ft int
.Fn pthread_kill "pthread_t thread" "int sig"
.Sh DESCRIPTION
The
.Fn pthread_kill
function sends a signal, specified by
.Fa sig ,
to a thread, specified by
.Fa thread .
If
.Fa sig
is 0, error checking is performed, but no signal is actually sent.
.Sh RETURN VALUES
If successful,
.Fn pthread_kill
returns 0.
Otherwise, an error number is returned.
.Sh ERRORS
The
.Fn pthread_kill
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
.Fa thread
is an invalid thread ID.
.It Bq Er EINVAL
.Fa sig
is an invalid or unsupported signal number.
.El
.Sh SEE ALSO
.Xr kill 2 ,
.Xr pthread_self 3 ,
.Xr raise 3
.Sh STANDARDS
The
.Fn pthread_kill
function conforms to
.St -p1003.1-96

View File

@ -1,60 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_MAIN_NP 3
.Os
.Sh NAME
.Nm pthread_main_np
.Nd identify the initial thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_main_np void
.Sh DESCRIPTION
The
.Fn pthread_main_np
function
is used in userland threads environment to identify the initial thread.
Its semantics is similar to the Solaris's
.Fn thr_main
function.
.Sh RETURN VALUES
The
.Fn pthread_main_np
function returns
1 if the calling thread is the initial thread,
0 if the calling thread is not the initial thread,
and \-1 if the thread's initialization has not yet completed.
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_equal 3 ,
.Xr pthread_self 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,66 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_MULTI_NP 3
.Os
.Sh NAME
.Nm pthread_multi_np ,
.Nm pthread_single_np
.Nd "switch between multi- and single-threaded scheduling modes"
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_multi_np void
.Ft int
.Fn pthread_single_np void
.Sh DESCRIPTION
The
.Fn pthread_single_np
function switches the process to a single-threaded mode, i.e.,
suspends all threads except the current.
The semantics of this function is similar to
.Xr pthread_suspend_all_np 3 .
.Pp
The
.Fn pthread_multi_np
function switches the process to a multi-threaded mode.
The semantics of this function is similar to
.Xr pthread_resume_all_np 3 .
.Sh RETURN VALUES
The
.Fn pthread_multi_np
and
.Nm pthread_single_np
functions always return 0.
.Sh SEE ALSO
.Xr pthread_resume_all_np 3 ,
.Xr pthread_suspend_all_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,74 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 29, 1998
.Dt PTHREAD_MUTEX_DESTROY 3
.Os
.Sh NAME
.Nm pthread_mutex_destroy
.Nd free resources allocated for a mutex
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_destroy "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_destroy
function frees the resources allocated for
.Fa mutex .
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_destroy
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EBUSY
.Fa Mutex
is locked by another thread.
.El
.Sh SEE ALSO
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_destroy
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 29, 1998
.Dt PTHREAD_MUTEX_INIT 3
.Os
.Sh NAME
.Nm pthread_mutex_init
.Nd create a mutex
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_init "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_mutex_init
function creates a new mutex, with attributes specified with
.Fa attr .
If
.Fa attr
is NULL the default attributes are used.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_init
will return zero and put the new mutex id into
.Fa mutex ,
otherwise an error number will be returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.It Bq Er ENOMEM
The process cannot allocate enough memory to create another mutex.
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_init
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_LOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_lock
.Nd lock a mutex
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_lock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_lock
function locks
.Fa mutex .
If the mutex is already locked, the calling thread will block until the
mutex becomes available.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_lock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_lock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EDEADLK
A deadlock would occur if the thread blocked waiting for
.Fa mutex .
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_lock
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_TRYLOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_trylock
.Nd attempt to lock a mutex without blocking
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_trylock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_trylock
function locks
.Fa mutex .
If the mutex is already locked,
.Fn pthread_mutex_trylock
will not block waiting for the mutex, but will return an error condition.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_trylock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_trylock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EBUSY
.Fa Mutex
is already locked.
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_trylock
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_UNLOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_unlock
.Nd unlock a mutex
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_unlock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
If the current thread holds the lock on
.Fa mutex ,
then the
.Fn pthread_mutex_unlock
function unlocks
.Fa mutex .
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_unlock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_unlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EPERM
The current thread does not hold a lock on
.Fa mutex .
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3
.Sh STANDARDS
The
.Fn pthread_mutex_unlock
function conforms to
.St -p1003.1-96 .

View File

@ -1,187 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd May 1, 2000
.Dt PTHREAD_MUTEXATTR 3
.Os
.Sh NAME
.Nm pthread_mutexattr_init ,
.Nm pthread_mutexattr_destroy ,
.Nm pthread_mutexattr_setprioceiling ,
.Nm pthread_mutexattr_getprioceiling ,
.Nm pthread_mutexattr_setprotocol ,
.Nm pthread_mutexattr_getprotocol ,
.Nm pthread_mutexattr_settype ,
.Nm pthread_mutexattr_gettype
.Nd mutex attribute operations
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutexattr_init "pthread_mutexattr_t *attr"
.Ft int
.Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr"
.Ft int
.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int prioceiling"
.Ft int
.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *prioceiling"
.Ft int
.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
.Ft int
.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
.Ft int
.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
.Ft int
.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
.Sh DESCRIPTION
Mutex attributes are used to specify parameters to
.Fn pthread_mutex_init .
One attribute object can be used in multiple calls to
.Fn pthread_mutex_init ,
with or without modifications between calls.
.Pp
The
.Fn pthread_mutexattr_init
function initializes
.Fa attr
with all the default mutex attributes.
.Pp
The
.Fn pthread_mutexattr_destroy
function destroys
.Fa attr .
.Pp
The
.Fn pthread_mutexattr_set*
functions set the attribute that corresponds to each function name.
.Pp
The
.Fn pthread_mutexattr_get*
functions copy the value of the attribute that corresponds to each function name
to the location pointed to by the second function parameter.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_mutexattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_mutexattr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_setprioceiling
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa prioceiling .
.El
.Pp
The
.Fn pthread_mutexattr_getprioceiling
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_setprotocol
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa protocol .
.El
.Pp
The
.Fn pthread_mutexattr_getprotocol
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_settype
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa type .
.El
.Pp
The
.Fn pthread_mutexattr_gettype
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Sh SEE ALSO
.Xr pthread_mutex_init 3
.Sh STANDARDS
The
.Fn pthread_mutexattr_init
and
.Fn pthread_mutexattr_destroy
functions conform to
.St -p1003.1-96
.Pp
The
.Fn pthread_mutexattr_setprioceiling ,
.Fn pthread_mutexattr_getprioceiling ,
.Fn pthread_mutexattr_setprotocol ,
.Fn pthread_mutexattr_getprotocol ,
.Fn pthread_mutexattr_settype ,
and
.Fn pthread_mutexattr_gettype
functions conform to
.St -susv2

View File

@ -1,81 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_MUTEXATTR_GETKIND_NP 3
.Os
.Sh NAME
.Nm pthread_mutexattr_getkind_np ,
.Nm pthread_mutexattr_setkind_np
.Nd mutex attribute operations (legacy)
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr"
.Ft int
.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr" "int kind"
.Sh DESCRIPTION
.Bf -symbolic
These functions are deprecated and non-portable implementation of
the mutex type manipulation.
.Ef
.Pp
It is recommended to use the
.Xr pthread_mutexattr_gettype 3
and
.Xr pthread_mutexattr_settype 3
functions instead.
.Sh RETURN VALUES
The
.Fn pthread_mutexattr_getkind_np
function returns a positive value representing the
.Dq kind
of the mutex attribute
.Fa attr
if successful; otherwise the value \-1 is returned and the global variable
.Va errno
is set to indicate the error.
.Pp
.Rv -std pthread_mutexattr_setkind_np
.Sh ERRORS
The
.Fn pthread_mutexattr_getkind_np
and
.Fn pthread_mutexattr_setkind_np
functions will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_mutexattr_gettype 3 ,
.Xr pthread_mutexattr_settype 3 ,
.Xr pthread_mutex_create 3 ,
.Xr pthread_mutex_destroy 3

View File

@ -1,106 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_ONCE 3
.Os
.Sh NAME
.Nm pthread_once
.Nd dynamic package initialization
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Pp
pthread_once_t
.Fa once_control
= PTHREAD_ONCE_INIT;
.Ft int
.Fn pthread_once "pthread_once_t *once_control" "void (*init_routine)(void)"
.Sh DESCRIPTION
The first call to
.Fn pthread_once
by any thread in a process, with a given
.Fa once_control ,
will call the
.Fn init_routine
with no arguments.
Subsequent calls to
.Fn pthread_once
with the same
.Fa once_control
will not call the
.Fn init_routine .
On return from
.Fn pthread_once ,
it is guaranteed that
.Fn init_routine
has completed.
The
.Fa once_control
parameter is used to determine whether the associated initialization
routine has been called.
.Pp
The function
.Fn pthread_once
is not a cancellation point.
However, if
.Fn init_routine
is a cancellation point and is cancelled, the effect on
.Fa once_control is as if
.Fn pthread_once
was never called.
.Pp
The constant
.Fa PTHREAD_ONCE_INIT
is defined by header
.In pthread.h .
.Pp
The behavior of
.Fn pthread_once
is undefined if
.Fa once_control
has automatic storage duration or is not initialized by
.Fa PTHREAD_ONCE_INIT .
.Sh RETURN VALUES
If successful, the
.Fn pthread_once
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
None.
.Sh STANDARDS
The
.Fn pthread_once
function conforms to
.St -p1003.1-96 .

View File

@ -1,51 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_RESUME_ALL_NP 3
.Os
.Sh NAME
.Nm pthread_resume_all_np
.Nd resume all suspended threads
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft void
.Fn pthread_resume_all_np void
.Sh DESCRIPTION
The
.Fn pthread_resume_all_np
function causes all active threads to be scanned
and resumes those which were previously suspended.
.Sh SEE ALSO
.Xr pthread_attr_setcreatesuspend_np 3 ,
.Xr pthread_resume_np 3 ,
.Xr pthread_suspend_all_np 3 ,
.Xr pthread_suspend_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_RESUME_NP 3
.Os
.Sh NAME
.Nm pthread_resume_np
.Nd resume suspended thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_resume_np "pthread_t tid"
.Sh DESCRIPTION
The
.Fn pthread_resume_np
function, called on a suspended thread, causes it to resume.
If a thread specified by the
.Fa tid
argument is not suspended, no actions will be performed.
.Sh RETURN VALUES
If successful,
.Fn pthread_resume_np
function returns 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_resume_np
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by the
.Fa tid
argument is invalid.
.It Bq ESRC
No thread could be found corresponding to the thread ID specified by the
.Fa tid
argument.
.El
.Sh SEE ALSO
.Xr pthread_attr_setcreatesuspend_np 3 ,
.Xr pthread_resume_all_np 3 ,
.Xr pthread_suspend_all_np 3 ,
.Xr pthread_suspend_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,82 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_DESTROY 3
.Os
.Sh NAME
.Nm pthread_rwlock_destroy
.Nd destroy a read/write lock
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_destroy "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_destroy
function is used to destroy a read/write lock previously created with
.Fn pthread_rwlock_init .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_destroy
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlock_destroy
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
The caller does not have the privilege to perform the operation.
.El
.Pp
The
.Fn pthread_rwlock_destroy
function may fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The system has detected an attempt to destroy the object referenced by
.Fa lock
while it is locked.
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_destroy
function first appeared in
.Fx 3.0 .

View File

@ -1,101 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_INIT 3
.Os
.Sh NAME
.Nm pthread_rwlock_init
.Nd initialize a read/write lock
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_init "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_init
function is used to initialize a read/write lock, with attributes
specified by
.Fa attr .
If
.Fa attr
is NULL, the default read/write lock attributes are used.
.Pp
The results of calling
.Fn pthread_rwlock_init
with an already initialized lock are undefined.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_init
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_destroy 3
.Sh STANDARDS
The
.Fn pthread_rwlock_init
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources (other than memory) to
initialize the lock.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock.
.It Bq Er EPERM
The caller does not have sufficient privilege to perform the
operation.
.El
.Pp
The
.Fn pthread_rwlock_init
function may fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The system has detected an attempt to re-initialize the object
referenced by
.Fa lock ,
a previously initialized but not yet destroyed read/write lock.
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_init
function first appeared in
.Fx 3.0 .
.Sh BUGS
The PTHREAD_PROCESS_SHARED attribute is not supported.

View File

@ -1,124 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_RDLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_rdlock ,
.Nm pthread_rwlock_tryrdlock
.Nd acquire a read/write lock for reading
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_rdlock
function acquires a read lock on
.Fa lock
provided that
.Fa lock
is not presently held for writing and no writer threads are
presently blocked on the lock. If the read lock cannot be
immediately acquired, the calling thread blocks until it can
acquire the lock.
.Pp
The
.Fn pthread_rwlock_tryrdlock
function performs the same action, but does not block if the lock
cannot be immediately obtained (i.e. the lock is held for writing
or there are waiting writers).
.Pp
A thread may hold multiple concurrent read locks. If so,
.Fn pthread_rwlock_unlock
must be called once for each lock obtained.
.Pp
The results of acquiring a read lock while the calling thread holds
a write lock are undefined.
.Sh IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3 ,
.Xr pthread_rwlock_trywrlock 3 ,
.Xr pthread_rwlock_unlock 3 ,
.Xr pthread_rwlock_wrlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions are expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_tryrdlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The lock could not be acquired because a writer holds the lock or
was blocked on it.
.El
.Pp
The
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions may fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The lock could not be acquired because the maximum number of read locks
against
.Fa lock
has been exceeded.
.It Bq Er EDEADLK
The current thread already owns
.Fa lock
for writing.
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock (applies to
statically initialized locks only).
.El
.Sh HISTORY
The
.Fn pthread_rwlock_rdlock
function first appeared in
.Fx 3.0 .

View File

@ -1,81 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_UNLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_unlock
.Nd release a read/write lock
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_unlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_unlock
function is used to release the read/write lock previously obtained by
.Fn pthread_rwlock_rdlock ,
.Fn pthread_rwlock_wrlock ,
.Fn pthread_rwlock_tryrdlock ,
or
.Fn pthread_rwlock_trywrlock .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_unlock
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Pp
The results are undefined if
.Fa lock
is not held by the calling thread.
.Sh SEE ALSO
.Xr pthread_rwlock_rdlock 3 ,
.Xr pthread_rwlock_wrlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_unlock
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_unlock
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er EPERM
The current thread does not own the read/write lock.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_unlock
function first appeared in
.Fx 3.0 .

View File

@ -1,105 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_WRLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_wrlock ,
.Nm pthread_rwlock_trywrlock
.Nd acquire a read/write lock for writing
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_wrlock
function blocks until a write lock can be acquired against
.Fa lock .
The
.Fn pthread_rwlock_trywrlock
function performs the same action, but does not block if the lock
cannot be immediately obtained.
.Pp
The results are undefined if the calling thread already holds the
lock at the time the call is made.
.Sh IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3 ,
.Xr pthread_rwlock_rdlock 3 ,
.Xr pthread_rwlock_tryrdlock 3 ,
.Xr pthread_rwlock_unlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions are expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_trywrlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The calling thread is not able to acquire the lock without blocking.
.El
.Pp
The
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions may fail if:
.Bl -tag -width Er
.It Bq Er EDEADLK
The calling thread already owns the read/write lock (for reading
or writing).
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock (applies to
statically initialized locks only).
.El
.Sh HISTORY
The
.Fn pthread_rwlock_wrlock
function first appeared in
.Fx 3.0 .

View File

@ -1,71 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_DESTROY 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_destroy
.Nd destroy a read/write lock
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_destroy "pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_destroy
function is used to destroy a read/write lock attribute object
previously created with
.Fn pthread_rwlockattr_init .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_destroy
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_destroy
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_destroy
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_destroy
function first appeared in
.Fx 3.0 .

View File

@ -1,83 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd March 22, 1999
.Dt PTHREAD_RWLOCKATTR_GETPSHARED 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_getpshared
.Nd get the process shared attribute
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_getpshared "const pthread_rwlockattr_t *attr" "int *pshared"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_getpshared
function is used to get the process shared setting of a read/write
lock attribute object. The setting is returned via
.Fa pshared ,
and may be one of two values:
.Bl -tag -width PTHREAD_PROCESS_PRIVATE
.It Dv PTHREAD_PROCESS_SHARED
Any thread of any process that has access to the memory where the
read/write lock resides can manipulate the lock.
.It Dv PTHREAD_PROCESS_PRIVATE
Only threads created within the same process as the thread that
initialized the read/write lock can manipulate the lock. This is
the default value.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_getpshared
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_getpshared
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_getpshared
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_getpshared
function first appeared in
.Fx 3.0 .

View File

@ -1,70 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_INIT 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_init
.Nd initialize a read/write lock
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_init "pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_init
function is used to initialize a read/write lock attributes object.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_init
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_destroy 3 ,
.Xr pthread_rwlockattr_getpshared 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_init
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficient memory exists to initialize the attribute object.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_init
function first appeared in
.Fx 3.0 .

View File

@ -1,92 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_SETPSHARED 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_setpshared
.Nd set the process shared attribute
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_setpshared "pthread_rwlockattr_t *attr" "int pshared"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_setpshared
function sets the process shared attribute of
.Fa attr
to the value referenced by
.Fa pshared .
The
.Fa pshared
argument may be one of two values:
.Bl -tag -width PTHREAD_PROCESS_PRIVATE
.It Dv PTHREAD_PROCESS_SHARED
Any thread of any process that has access to the memory where the
read/write lock resides can manipulate the lock.
.It Dv PTHREAD_PROCESS_PRIVATE
Only threads created within the same process as the thread that
initialized the read/write lock can manipulate the lock. This is
the default value.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_setpshared
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_getpshared 3 ,
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_setpshared
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_setpshared
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
or
.Fa pshared
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_setpshared
function first appeared in
.Fx 3.0 .
.Sh BUGS
The
.Dv PTHREAD_PROCESS_SHARED
attribute is not supported.

View File

@ -1,93 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd May 1, 2000
.Dt PTHREAD_SCHEDPARAM 3
.Os
.Sh NAME
.Nm pthread_setschedparam ,
.Nm pthread_getschedparam
.Nd thread scheduling parameter manipulation
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
.Ft int
.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
.Sh DESCRIPTION
The
.Fn pthread_setschedparam
and
.Fn pthread_getschedparam
functions set and get the scheduling parameters of individual threads.
The scheduling policy for a thread can either be
.Dv SCHED_FIFO
(first in, first out) or
.Dv SCHED_RR
(round-robin).
The thread priority (accessed via
.Va param->sched_priority )
must be at least
.Dv PTHREAD_MIN_PRIORITY
and no more than
.Dv PTHREAD_MAX_PRIORITY .
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_setschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Va policy .
.It Bq Er ENOTSUP
Invalid value for scheduling parameters.
.It Bq Er ESRCH
Non-existent thread
.Va thread .
.El
.Pp
The
.Fn pthread_getschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
Non-existent thread
.Va thread .
.El
.Sh STANDARDS
The
.Fn pthread_setschedparam
and
.Fn pthread_getschedparam
functions conform to
.St -susv2

View File

@ -1,62 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_SELF 3
.Os
.Sh NAME
.Nm pthread_self
.Nd get the calling thread's ID
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft pthread_t
.Fn pthread_self "void"
.Sh DESCRIPTION
The
.Fn pthread_self
function returns the thread ID of the calling thread.
.Sh RETURN VALUES
The
.Fn pthread_self
function returns the thread ID of the calling thread.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_equal 3
.Sh STANDARDS
The
.Fn pthread_self
function conforms to
.St -p1003.1-96 .

View File

@ -1,55 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_SET_NAME_NP 3
.Os
.Sh NAME
.Nm pthread_set_name_np
.Nd set the thread name
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft void
.Fn pthread_set_name_np "pthread_t tid" "const char *name"
.Sh DESCRIPTION
The
.Fn pthread_set_name_np
function sets internal name for thread specified by
.Fa tid
argument to string value specified by
.Fa name
argument.
.Pp
This is a debugging interface and using it on a day-by-day basis makes
no sense.
.Sh ERRORS
Because of the debugging nature of this function, all errors that may
appear inside are silently ignored.
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,98 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_SETSPECIFIC 3
.Os
.Sh NAME
.Nm pthread_setspecific
.Nd set a thread-specific data value
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setspecific "pthread_key_t key" "const void *value"
.Sh DESCRIPTION
The
.Fn pthread_setspecific
function associates a thread-specific value with a
.Fa key
obtained via a previous call to
.Fn pthread_key_create .
Different threads man bind different values to the same key.
These values are
typically pointers to blocks of dynamically allocated memory that have been
reserved for use by the calling thread.
.Pp
The effect of calling
.Fn pthread_setspecific
with a key value not obtained from
.Fn pthread_key_create
or after
.Fa key
has been deleted with
.Fn pthread_key_delete
is undefined.
.Pp
The
.Fn pthread_setspecific
function may be called from a thread-specific data destructor function,
however this may result in lost storage or infinite loops.
.Sh RETURN VALUES
If successful, the
.Fn pthread_setspecific
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_setspecific
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficient memory exists to associate the value with the
.Fa key .
.It Bq Er EINVAL
The
.Fa key
value is invalid.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_create 3 ,
.Xr pthread_key_delete 3
.Sh STANDARDS
The
.Fn pthread_setspecific
function conforms to
.St -p1003.1-96 .

View File

@ -1,98 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 27, 2000
.Dt PTHREAD_SIGMASK 3
.Os
.Sh NAME
.Nm pthread_sigmask
.Nd examine and/or change a thread's signal mask
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.In signal.h
.Ft int
.Fn pthread_sigmask "int how" "const sigset_t *set" "sigset_t *oset"
.Sh DESCRIPTION
The
.Fn pthread_sigmask
function examines and/or changes the calling thread's signal mask.
.Pp
If
.Fa set
is not
.Dv NULL ,
it specifies a set of signals to be modified, and
.Fa how
specifies what to set the signal mask to:
.Bl -tag -width SIG_UNBLOCK
.It Dv SIG_BLOCK
Union of the current mask and
.Fa set .
.It Dv SIG_UNBLOCK
Intersection of the current mask and the complement of
.Fa set .
.It Dv SIG_SETMASK
.Fa set .
.El
.Pp
If
.Fa oset
is not NULL, the previous signal mask is stored in the location pointed to by
.Fa oset .
.Pp
.Dv SIGKILL
and
.Dv SIGSTOP
cannot be blocked, and will be silently ignored if included in the signal mask.
.Sh RETURN VALUES
If successful,
.Fn pthread_sigmask
returns 0.
Otherwise, an error is returned.
.Sh ERRORS
The
.Fn pthread_sigmask
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa how
is not one of the defined values.
.El
.Sh SEE ALSO
.Xr sigaction 2 ,
.Xr sigpending 2 ,
.Xr sigprocmask 2 ,
.Xr sigsuspend 2 ,
.Xr sigsetops 3
.Sh STANDARDS
The
.Fn pthread_sigmask
function conforms to
.St -p1003.1-96

View File

@ -1,53 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_SUSPEND_ALL_NP 3
.Os
.Sh NAME
.Nm pthread_suspend_all_np
.Nd suspend all active threads
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft void
.Fn pthread_suspend_all_np void
.Sh DESCRIPTION
The
.Fn pthread_suspend_all_np
function causes all active threads to be suspended.
The only exception is the current thread,
the thread that called the
.Fn pthread_suspend_all_np
function.
.Sh SEE ALSO
.Xr pthread_resume_all_np 3 ,
.Xr pthread_resume_np 3 ,
.Xr pthread_suspend_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,70 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_SUSPEND_NP 3
.Os
.Sh NAME
.Nm pthread_suspend_np
.Nd suspend a thread
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_suspend_np "pthread_t tid"
.Sh DESCRIPTION
The
.Fn pthread_suspend_np
function, called on an active thread, causes it to suspend.
.Sh RETURN VALUES
If successful,
.Fn pthread_suspend_np
function returns 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_suspend_np
function will fail if:
.Bl -tag -width Er
.It Bq Er EDEADLK
An attempt was made to suspend the current thread.
.It Bq Er EINVAL
The value specified by the
.Fa tid
argument is invalid.
.It Bq ESRC
No thread could be found corresponding to the thread ID specified by the
.Fa tid
argument.
.El
.Sh SEE ALSO
.Xr pthread_resume_all_np 3 ,
.Xr pthread_resume_np 3 ,
.Xr pthread_suspend_all_np 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,87 +0,0 @@
.\" Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd February 13, 2003
.Dt PTHREAD_SWITCH_ADD_NP 3
.Os
.Sh NAME
.Nm pthread_switch_add_np ,
.Nm pthread_switch_delete_np
.Nd thread context switches debugging primitives
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_switch_add_np "pthread_switch_routine_t routine"
.Ft int
.Fn pthread_switch_delete_np "pthread_switch_routine_t routine"
.Sh DESCRIPTION
An application is allowed to monitor the thread context switches inside
the threading library.
An application can install a routine that gets called every time a thread
(explicitly created by an application with the
.Xr pthread_create 3
function) gets the context switched.
The routine is passed the thread IDs of the threads that are
being switched in and out.
Installation and removal of these hooks may be done using the
.Fn pthread_switch_add_np
and
.Fn pthread_switch_delete_np
functions respectively.
.Sh RETURN VALUES
If successful,
these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_switch_add_np
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Dv NULL
pointer was passed in the
.Fa routine
argument.
.El
.Pp
The
.Fn pthread_switch_delete_np
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa routine
argument is different from the argument previously passed to the
.Fn pthread_switch_add_np
function.
.El
.Sh SEE ALSO
.Xr pthread_create 3
.Sh AUTHORS
This manual page was written by
.An Alexey Zelkin Aq phantom@FreeBSD.org .

View File

@ -1,210 +0,0 @@
.\" $FreeBSD$
.Dd January 17, 1999
.Dt PTHREAD_TESTCANCEL 3
.Os
.Sh NAME
.Nm pthread_setcancelstate ,
.Nm pthread_setcanceltype ,
.Nm pthread_testcancel
.Nd set cancelability state
.Sh LIBRARY
.Lb libc_r
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setcancelstate "int state" "int *oldstate"
.Ft int
.Fn pthread_setcanceltype "int type" "int *oldtype"
.Ft void
.Fn pthread_testcancel "void"
.Sh DESCRIPTION
The
.Fn pthread_setcancelstate
function atomically both sets the calling thread's cancelability state
to the indicated
.Fa state
and, if
.Fa oldstate
is not
.Dv NULL ,
returns the previous cancelability state at the location referenced by
.Fa oldstate .
Legal values for
.Fa state
are
.Dv PTHREAD_CANCEL_ENABLE
and
.Dv PTHREAD_CANCEL_DISABLE .
.Pp
The
.Fn pthread_setcanceltype
function atomically both sets the calling thread's cancelability type
to the indicated
.Fa type
and, if
.Fa oldtype
is not
.Dv NULL ,
returns the previous cancelability type at the location referenced by
.Fa oldtype .
Legal values for
.Fa type
are
.Dv PTHREAD_CANCEL_DEFERRED
and
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
.Pp
The cancelability state and type of any newly created threads, including the
thread in which
.Fn main
was first invoked, are
.Dv PTHREAD_CANCEL_ENABLE
and
.Dv PTHREAD_CANCEL_DEFERRED
respectively.
.Pp
The
.Fn pthread_testcancel
function creates a cancellation point in the calling thread.
The
.Fn pthread_testcancel
function has no effect if cancelability is disabled.
.Pp
.Ss Cancelability States
The cancelability state of a thread determines the action taken upon
receipt of a cancellation request.
The thread may control cancellation in
a number of ways.
.Pp
Each thread maintains its own
.Dq cancelability state
which may be encoded in two bits:
.Bl -hang
.It Em Cancelability Enable
When cancelability is
.Dv PTHREAD_CANCEL_DISABLE ,
cancellation requests against the target thread are held pending.
.It Em Cancelability Type
When cancelability is enabled and the cancelability type is
.Dv PTHREAD_CANCEL_ASYNCHRONOUS ,
new or pending cancellation requests may be acted upon at any time.
When cancelability is enabled and the cancelability type is
.Dv PTHREAD_CANCEL_DEFERRED ,
cancellation requests are held pending until a cancellation point (see
below) is reached.
If cancelability is disabled, the setting of the
cancelability type has no immediate effect as all cancellation requests
are held pending; however, once cancelability is enabled again the new
type will be in effect.
.El
.Ss Cancellation Points
Cancellation points will occur when a thread is executing the following
functions:
.Fn close ,
.Fn creat ,
.Fn fcntl ,
.Fn fsync ,
.Fn msync ,
.Fn nanosleep ,
.Fn open ,
.Fn pause ,
.Fn pthread_cond_timedwait ,
.Fn pthread_cond_wait ,
.Fn pthread_join ,
.Fn pthread_testcancel ,
.Fn read ,
.Fn sigwaitinfo ,
.Fn sigsuspend ,
.Fn sigwait ,
.Fn sleep ,
.Fn system ,
.Fn tcdrain ,
.Fn wait ,
.Fn waitpid ,
.Fn write .
.Sh RETURN VALUES
If successful, the
.Fn pthread_setcancelstate
and
.Fn pthread_setcanceltype
functions will return zero.
Otherwise, an error number shall be returned to
indicate the error.
.Pp
The
.Fn pthread_setcancelstate
and
.Fn pthread_setcanceltype
functions are used to control the points at which a thread may be
asynchronously canceled.
For cancellation control to be usable in modular
fashion, some rules must be followed.
.Pp
For purposes of this discussion, consider an object to be a generalization
of a procedure.
It is a set of procedures and global variables written as
a unit and called by clients not known by the object.
Objects may depend
on other objects.
.Pp
First, cancelability should only be disabled on entry to an object, never
explicitly enabled.
On exit from an object, the cancelability state should
always be restored to its value on entry to the object.
.Pp
This follows from a modularity argument: if the client of an object (or the
client of an object that uses that object) has disabled cancelability, it is
because the client doesn't want to have to worry about how to clean up if the
thread is canceled while executing some sequence of actions.
If an object
is called in such a state and it enables cancelability and a cancellation
request is pending for that thread, then the thread will be canceled,
contrary to the wish of the client that disabled.
.Pp
Second, the cancelability type may be explicitly set to either
.Em deferred
or
.Em asynchronous
upon entry to an object.
But as with the cancelability state, on exit from
an object that cancelability type should always be restored to its value on
entry to the object.
.Pp
Finally, only functions that are cancel-safe may be called from a thread that
is asynchronously cancelable.
.Sh ERRORS
The function
.Fn pthread_setcancelstate
may fail with:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified state is not
.Dv PTHREAD_CANCEL_ENABLE
or
.Dv PTHREAD_CANCEL_DISABLE .
.El
.Pp
The function
.Fn pthread_setcanceltype
may fail with:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified state is not
.Dv PTHREAD_CANCEL_DEFERRED
or
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
.El
.Sh SEE ALSO
.Xr pthread_cancel 3
.Sh STANDARDS
The
.Fn pthread_testcancel
function conforms to
.St -p1003.1-96 .
.Sh AUTHORS
This man page was written by
.An David Leonard Aq d@openbsd.org
for the
.Ox
implementation of
.Xr pthread_cancel 3 .

View File

@ -1,96 +0,0 @@
# $FreeBSD$
# POSIX thread man files
.PATH: ${.CURDIR}/man
MAN+= pthread_attr.3 \
pthread_attr_get_np.3 \
pthread_cancel.3 \
pthread_cleanup_pop.3 \
pthread_cleanup_push.3 \
pthread_condattr.3 \
pthread_cond_broadcast.3 \
pthread_cond_destroy.3 \
pthread_cond_init.3 \
pthread_cond_signal.3 \
pthread_cond_timedwait.3 \
pthread_cond_wait.3 \
pthread_create.3 \
pthread_detach.3 \
pthread_equal.3 \
pthread_exit.3 \
pthread_getspecific.3 \
pthread_join.3 \
pthread_key_create.3 \
pthread_key_delete.3 \
pthread_kill.3 \
pthread_mutexattr.3 \
pthread_mutex_destroy.3 \
pthread_mutex_init.3 \
pthread_mutex_lock.3 \
pthread_mutex_trylock.3 \
pthread_mutex_unlock.3 \
pthread_once.3 \
pthread_rwlock_destroy.3 \
pthread_rwlock_init.3 \
pthread_rwlock_rdlock.3 \
pthread_rwlock_unlock.3 \
pthread_rwlock_wrlock.3 \
pthread_rwlockattr_destroy.3 \
pthread_rwlockattr_getpshared.3 \
pthread_rwlockattr_init.3 \
pthread_rwlockattr_setpshared.3 \
pthread_schedparam.3 \
pthread_self.3 \
pthread_setspecific.3 \
pthread_sigmask.3 \
pthread_testcancel.3 \
sem_destroy.3 \
sem_getvalue.3 \
sem_init.3 \
sem_open.3 \
sem_post.3 \
sem_wait.3 \
sigwait.3
MLINKS+= \
pthread_attr.3 pthread_attr_destroy.3 \
pthread_attr.3 pthread_attr_getdetachstate.3 \
pthread_attr.3 pthread_attr_getguardsize.3 \
pthread_attr.3 pthread_attr_getinheritsched.3 \
pthread_attr.3 pthread_attr_getschedparam.3 \
pthread_attr.3 pthread_attr_getschedpolicy.3 \
pthread_attr.3 pthread_attr_getscope.3 \
pthread_attr.3 pthread_attr_getstack.3 \
pthread_attr.3 pthread_attr_getstackaddr.3 \
pthread_attr.3 pthread_attr_getstacksize.3 \
pthread_attr.3 pthread_attr_init.3 \
pthread_attr.3 pthread_attr_setdetachstate.3 \
pthread_attr.3 pthread_attr_setguardsize.3 \
pthread_attr.3 pthread_attr_setinheritsched.3 \
pthread_attr.3 pthread_attr_setschedparam.3 \
pthread_attr.3 pthread_attr_setschedpolicy.3 \
pthread_attr.3 pthread_attr_setscope.3 \
pthread_attr.3 pthread_attr_setstack.3 \
pthread_attr.3 pthread_attr_setstackaddr.3 \
pthread_attr.3 pthread_attr_setstacksize.3 \
pthread_condattr.3 pthread_condattr_init.3 \
pthread_condattr.3 pthread_condattr_destroy.3 \
pthread_mutexattr.3 pthread_mutexattr_init.3 \
pthread_mutexattr.3 pthread_mutexattr_destroy.3 \
pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3 \
pthread_mutexattr.3 pthread_mutexattr_getprotocol.3 \
pthread_mutexattr.3 pthread_mutexattr_gettype.3 \
pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3 \
pthread_mutexattr.3 pthread_mutexattr_setprotocol.3 \
pthread_mutexattr.3 pthread_mutexattr_settype.3 \
pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 \
pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 \
pthread_schedparam.3 pthread_getschedparam.3 \
pthread_schedparam.3 pthread_setschedparam.3 \
pthread_testcancel.3 pthread_setcancelstate.3 \
pthread_testcancel.3 pthread_setcanceltype.3 \
sem_open.3 sem_close.3 \
sem_open.3 sem_unlink.3 \
sem_wait.3 sem_trywait.3

View File

@ -1,237 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 28, 2000
.Dt PTHREAD_ATTR 3
.Os
.Sh NAME
.Nm pthread_attr_init ,
.Nm pthread_attr_destroy ,
.Nm pthread_attr_setstack ,
.Nm pthread_attr_getstack ,
.Nm pthread_attr_setstacksize ,
.Nm pthread_attr_getstacksize ,
.Nm pthread_attr_setguardsize ,
.Nm pthread_attr_getguardsize ,
.Nm pthread_attr_setstackaddr ,
.Nm pthread_attr_getstackaddr ,
.Nm pthread_attr_setdetachstate ,
.Nm pthread_attr_getdetachstate ,
.Nm pthread_attr_setinheritsched ,
.Nm pthread_attr_getinheritsched ,
.Nm pthread_attr_setschedparam ,
.Nm pthread_attr_getschedparam ,
.Nm pthread_attr_setschedpolicy ,
.Nm pthread_attr_getschedpolicy ,
.Nm pthread_attr_setscope ,
.Nm pthread_attr_getscope
.Nd thread attribute operations
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_init "pthread_attr_t *attr"
.Ft int
.Fn pthread_attr_destroy "pthread_attr_t *attr"
.Ft int
.Fn pthread_attr_setstack "pthread_attr_t *attr" " void *stackaddr" "size_t stacksize"
.Ft int
.Fn pthread_attr_getstack "const pthread_attr_t * restrict attr" "void ** restrict stackaddr" "size_t * restrict stacksize"
.Ft int
.Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
.Ft int
.Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
.Ft int
.Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
.Ft int
.Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
.Ft int
.Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
.Ft int
.Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
.Ft int
.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
.Ft int
.Fn pthread_attr_getdetachstate "const pthread_attr_t *attr" "int *detachstate"
.Ft int
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
.Ft int
.Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched"
.Ft int
.Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param"
.Ft int
.Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param"
.Ft int
.Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
.Ft int
.Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
.Ft int
.Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
.Ft int
.Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .
One attribute object can be used in multiple calls to
.Fn pthread_create ,
with or without modifications between calls.
.Pp
The
.Fn pthread_attr_init
function initializes
.Fa attr
with all the default thread attributes.
.Pp
The
.Fn pthread_attr_destroy
function destroys
.Fa attr .
.Pp
The
.Fn pthread_attr_set*
functions set the attribute that corresponds to each function name.
.Pp
The
.Fn pthread_attr_get*
functions copy the value of the attribute that corresponds to each function name
to the location pointed to by the second function parameter.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_attr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_attr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_attr_setstacksize
and
.Fn pthread_attr_setstack
functions will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa stacksize
is less than
.Dv PTHREAD_STACK_MIN .
.El
.Pp
The
.Fn pthread_attr_setdetachstate
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa detachstate .
.El
.Pp
The
.Fn pthread_attr_setinheritsched
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_attr_setschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid value for
.Fa param .
.El
.Pp
The
.Fn pthread_attr_setschedpolicy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid or unsupported value for
.Fa policy .
.El
.Pp
The
.Fn pthread_attr_setscope
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.It Bq Er ENOTSUP
Invalid or unsupported value for
.Fa contentionscope .
.El
.Sh SEE ALSO
.Xr pthread_create 3
.Sh STANDARDS
The
.Fn pthread_attr_init ,
.Fn pthread_attr_destroy ,
.Fn pthread_attr_setstacksize ,
.Fn pthread_attr_getstacksize ,
.Fn pthread_attr_setstackaddr ,
.Fn pthread_attr_getstackaddr ,
.Fn pthread_attr_setdetachstate ,
and
.Fn pthread_attr_getdetachstate
functions conform to
.St -p1003.1-96
.Pp
The
.Fn pthread_attr_setinheritsched ,
.Fn pthread_attr_getinheritsched ,
.Fn pthread_attr_setschedparam ,
.Fn pthread_attr_getschedparam ,
.Fn pthread_attr_setschedpolicy ,
.Fn pthread_attr_getschedpolicy ,
.Fn pthread_attr_setscope ,
and
.Fn pthread_attr_getscope
functions conform to
.St -susv2

View File

@ -1,116 +0,0 @@
.\" Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 31, 2003
.Dt PTHREAD_ATTR_GET_NP 3
.Os
.Sh NAME
.Nm pthread_attr_get_np
.Nd get attributes of existent thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread_np.h
.Ft int
.Fn pthread_attr_get_np "pthread_t pid" "pthread_attr_t *dst"
.Sh DESCRIPTION
The
.Fn pthread_attr_get_np
function is used to get existent thread's attributes.
Most fields of
.Vt pthread_attr_t
structure are exact values of attributes provided at thread creation
time (as parameter to
.Xr pthread_create 3
function), except for the stack address.
.Pp
Value returned as
.Fa dst
is supposed to be used in conjunction with
.Fn pthread_attr_get*
functions to retrieve individual values from
.Vt pthread_attr_t
structure.
Parameter
.Fa dst
should point to allocated memory area big enough to fit this structure.
.Pp
It is HIGHLY RECOMMENDED to use
.Xr pthread_attr_init 3
function to allocate attribute storage.
.Sh IMPLEMENTATION NOTES
The
.Fn pthread_attr_get_np
function will always return a pointer to the thread's real stack address,
regardless of its value in the original attributes structure.
.Sh EXAMPLES
.Bd -literal
size_t
my_thread_stack_size(pthread_t pid)
{
pthread_attr_t attr;
size_t size;
pthread_attr_init(&attr);
pthread_attr_get_np(pid, &attr);
pthread_attr_getstacksize(&attr, &size);
pthread_attr_destroy(&attr);
return(size);
}
.Ed
.Sh RETURN VALUES
If successful,
.Fn pthread_attr_get_np
function returns 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_attr_get_np
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for one of given parameters.
.It Bq Er ESRC
No thread could be found corresponding to that specified by the given
thread ID.
.El
.Sh SEE ALSO
.Xr pthread_attr_destroy 3 ,
.Xr pthread_attr_getdetachstate 3 ,
.Xr pthread_attr_getinheritsched 3 ,
.Xr pthread_attr_getschedparam 3 ,
.Xr pthread_attr_getschedpolicy 3 ,
.Xr pthread_attr_getscope 3 ,
.Xr pthread_attr_getstack 3 ,
.Xr pthread_attr_getstackaddr 3 ,
.Xr pthread_attr_getstacksize 3 ,
.Xr pthread_attr_init 3
.Sh AUTHORS
The
.Fn pthread_attr_get_np
function and this manual page were written by
.An Alexey Zelkin
.Aq phantom@FreeBSD.org .

View File

@ -1,81 +0,0 @@
.\" $FreeBSD$
.Dd January 17, 1999
.Dt PTHREAD_CANCEL 3
.Os
.Sh NAME
.Nm pthread_cancel
.Nd cancel execution of a thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cancel "pthread_t thread"
.Sh DESCRIPTION
The
.Fn pthread_cancel
function requests that
.Fa thread
be canceled.
The target thread's cancelability state and type determines
when the cancellation takes effect.
When the cancellation is acted on,
the cancellation cleanup handlers for
.Fa thread
are called.
When the last cancellation cleanup handler returns,
the thread-specific data destructor functions will be called for
.Fa thread .
When the last destructor function returns,
.Fa thread
will be terminated.
.Pp
The cancellation processing in the target thread runs asynchronously with
respect to the calling thread returning from
.Fn pthread_cancel .
.Pp
A status of
.Dv PTHREAD_CANCELED
is made available to any threads joining with the target.
The symbolic
constant
.Dv PTHREAD_CANCELED
expands to a constant expression of type
.Ft "(void *)" ,
whose value matches no pointer to an object in memory nor the value
.Dv NULL .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cancel
functions will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cancel
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID.
.El
.Sh SEE ALSO
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3 ,
.Xr pthread_join 3 ,
.Xr pthread_setcancelstate 3 ,
.Xr pthread_setcanceltype 3 ,
.Xr pthread_testcancel 3
.Sh STANDARDS
The
.Fn pthread_cancel
function conforms to
.St -p1003.1-96 .
.Sh AUTHORS
This man page was written by
.An David Leonard Aq d@openbsd.org
for the
.Ox
implementation of
.Fn pthread_cancel .

View File

@ -1,66 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_CLEANUP_POP 3
.Os
.Sh NAME
.Nm pthread_cleanup_pop
.Nd call the first cleanup routine
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_cleanup_pop "int execute"
.Sh DESCRIPTION
The
.Fn pthread_cleanup_pop
function pops the top cleanup routine off of the current threads cleanup
routine stack, and, if
.Fa execute
is non-zero, it will execute the function.
If there is no cleanup routine
then
.Fn pthread_cleanup_pop
does nothing.
.Sh RETURN VALUES
The
.Fn pthread_cleanup_pop
function does not return any value.
.Sh ERRORS
None
.Sh SEE ALSO
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_cleanup_pop
function conforms to
.St -p1003.1-96 .

View File

@ -1,68 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_CLEANUP_PUSH 3
.Os
.Sh NAME
.Nm pthread_cleanup_push
.Nd add a cleanup function for thread exit
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_cleanup_push "void \*[lp]*cleanup_routine\*[rp]\*[lp]void *\*[rp]" "void *arg"
.Sh DESCRIPTION
The
.Fn pthread_cleanup_push
function adds
.Fa cleanup_routine
to the top of the stack of cleanup handlers that
get called when the current thread exits.
.Pp
When
.Fa cleanup_routine
is called, it is passed
.Fa arg
as its only argument.
.Sh RETURN VALUES
The
.Fn pthread_cleanup_push
function does not return any value.
.Sh ERRORS
None
.Sh SEE ALSO
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_cleanup_push
function conforms to
.St -p1003.1-96 .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_BROADCAST 3
.Os
.Sh NAME
.Nm pthread_cond_broadcast
.Nd unblock all threads waiting for a condition variable
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_broadcast "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_broadcast
function unblocks all threads waiting for the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_broadcast
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_broadcast
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_broadcast
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_DESTROY 3
.Os
.Sh NAME
.Nm pthread_cond_destroy
.Nd destroy a condition variable
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_destroy "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_destroy
function frees the resources allocated by the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_destroy
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.It Bq Er EBUSY
The variable
.Fa cond
is locked by another thread.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_destroy
function conforms to
.St -p1003.1-96 .

View File

@ -1,82 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_INIT 3
.Os
.Sh NAME
.Nm pthread_cond_init
.Nd create a condition variable
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_init "pthread_cond_t *cond" "const pthread_condattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_cond_init
function creates a new condition variable, with attributes specified with
.Fa attr .
If
.Fa attr
is NULL the default attributes are used.
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_init
function will return zero and put the new condition variable id into
.Fa cond ,
otherwise an error number will be returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.It Bq Er ENOMEM
The process cannot allocate enough memory to create another condition
variable.
.It Bq Er EAGAIN
The system temporarily lacks the resources to create another condition
variable.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_init
function conforms to
.St -p1003.1-96 .

View File

@ -1,72 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_SIGNAL 3
.Os
.Sh NAME
.Nm pthread_cond_signal
.Nd unblock a thread waiting for a condition variable
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_signal "pthread_cond_t *cond"
.Sh DESCRIPTION
The
.Fn pthread_cond_signal
function unblocks one thread waiting for the condition variable
.Fa cond .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_signal
function will return zero, otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_signal
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_timedwait 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_signal
function conforms to
.St -p1003.1-96 .

View File

@ -1,91 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_TIMEDWAIT 3
.Os
.Sh NAME
.Nm pthread_cond_timedwait
.Nd "wait on a condition variable for a specific amount of time"
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_timedwait "pthread_cond_t *cond" "pthread_mutex_t *mutex" "const struct timespec *abstime"
.Sh DESCRIPTION
The
.Fn pthread_cond_timedwait
function atomically blocks the current thread waiting on the condition
variable specified by
.Fa cond ,
and unblocks the mutex specified by
.Fa mutex .
The waiting thread unblocks only after another thread calls
.Xr pthread_cond_signal 3 ,
or
.Xr pthread_cond_broadcast 3
with the same condition variable, or if the system time reaches the
time specified in
.Fa abstime ,
and the current thread reacquires the lock on
.Fa mutex .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_timedwait
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_timedwait
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond ,
.Fa mutex
or
.Fa abstime
is invalid.
.It Bq Er ETIMEDOUT
The system time has reached or exceeded the time specified in
.Fa abstime .
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_wait 3
.Sh STANDARDS
The
.Fn pthread_cond_timedwait
function conforms to
.St -p1003.1-96 .

View File

@ -1,85 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 28, 1998
.Dt PTHREAD_COND_WAIT 3
.Os
.Sh NAME
.Nm pthread_cond_wait
.Nd wait on a condition variable
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_wait "pthread_cond_t *cond" "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_cond_wait
function atomically blocks the current thread waiting on the condition
variable specified by
.Fa cond ,
and unblocks the mutex specified by
.Fa mutex .
The waiting thread unblocks only after another thread calls
.Xr pthread_cond_signal 3 ,
or
.Xr pthread_cond_broadcast 3
with the same condition variable, and the current thread reacquires the lock
on
.Fa mutex .
.Sh RETURN VALUES
If successful, the
.Fn pthread_cond_wait
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_cond_wait
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa cond
or the value specified by
.Fa mutex
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_cond_broadcast 3 ,
.Xr pthread_cond_destroy 3 ,
.Xr pthread_cond_init 3 ,
.Xr pthread_cond_signal 3 ,
.Xr pthread_cond_timedwait 3
.Sh STANDARDS
The
.Fn pthread_cond_wait
function conforms to
.St -p1003.1-96 .

View File

@ -1,88 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 28, 2000
.Dt PTHREAD_CONDATTR 3
.Os
.Sh NAME
.Nm pthread_condattr_init ,
.Nm pthread_condattr_destroy
.Nd condition attribute operations
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_condattr_init "pthread_condattr_t *attr"
.Ft int
.Fn pthread_condattr_destroy "pthread_condattr_t *attr"
.Sh DESCRIPTION
Condition attribute objects are used to specify parameters to
.Fn pthread_cond_init .
.Fx Ns 's
implementation of conditions does not support any non-default
attributes, so these functions are not very useful, though they are required
to be present by
.Tn POSIX .
.Pp
The
.Fn pthread_condattr_init
function initializes a condition attribute object with the default attributes.
.Pp
The
.Fn pthread_condattr_destroy
function destroys a condition attribute object.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_condattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_condattr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Sh SEE ALSO
.Xr pthread_cond_init 3
.Sh STANDARDS
The
.Fn pthread_condattr_init
and
.Fn pthread_condattr_destroy
functions conform to
.St -p1003.1-96

View File

@ -1,125 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_CREATE 3
.Os
.Sh NAME
.Nm pthread_create
.Nd create a new thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_create "pthread_t *thread" "const pthread_attr_t *attr" "void *(*start_routine)(void *)" "void *arg"
.Sh DESCRIPTION
The
.Fn pthread_create
function is used to create a new thread, with attributes specified by
.Fa attr ,
within a process.
If
.Fa attr
is
.Dv NULL ,
the default attributes are used.
If the attributes specified by
.Fa attr
are modified later, the thread's attributes are not affected.
Upon
successful completion
.Fn pthread_create
will store the ID of the created thread in the location specified by
.Fa thread .
.Pp
The thread is created executing
.Fa start_routine
with
.Fa arg
as its sole argument.
If the
.Fa start_routine
returns, the effect is as if there was an implicit call to
.Fn pthread_exit
using the return value of
.Fa start_routine
as the exit status.
Note that the thread in which
.Fn main
was originally invoked differs from this.
When it returns from
.Fn main ,
the effect is as if there was an implicit call to
.Fn exit
using the return value of
.Fn main
as the exit status.
.Pp
The signal state of the new thread is initialized as:
.Bl -bullet -offset indent
.It
The signal mask is inherited from the creating thread.
.It
The set of signals pending for the new thread is empty.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_create
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_create
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources to create another thread, or
the system-imposed limit on the total number of threads in a process
[PTHREAD_THREADS_MAX] would be exceeded.
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh SEE ALSO
.Xr fork 2 ,
.Xr pthread_cleanup_pop 3 ,
.Xr pthread_cleanup_push 3 ,
.Xr pthread_exit 3 ,
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_create
function conforms to
.St -p1003.1-96 .

View File

@ -1,91 +0,0 @@
.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_DETACH 3
.Os
.Sh NAME
.Nm pthread_detach
.Nd detach a thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_detach "pthread_t thread"
.Sh DESCRIPTION
The
.Fn pthread_detach
function is used to indicate to the implementation that storage for the
thread
.Fa thread
can be reclaimed when the thread terminates.
If
.Fa thread
has not terminated,
.Fn pthread_detach
will not cause it to terminate.
The effect of multiple
.Fn pthread_detach
calls on the same target thread is unspecified.
.Sh RETURN VALUES
If successful, the
.Fn pthread_detach
function will return zero.
Otherwise an error number will be returned to
indicate the error.
Note that the function does not change the value
of errno as it did for some drafts of the standard.
These early drafts
also passed a pointer to pthread_t as the argument.
Beware!
.Sh ERRORS
The
.Fn pthread_detach
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The implementation has detected that the value specified by
.Fa thread
does not refer to a joinable thread.
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID,
.Fa thread .
.El
.Sh SEE ALSO
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_detach
function conforms to
.St -p1003.1-96 .

View File

@ -1,69 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_EQUAL 3
.Os
.Sh NAME
.Nm pthread_equal
.Nd compare thread IDs
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_equal "pthread_t t1" "pthread_t t2"
.Sh DESCRIPTION
The
.Fn pthread_equal
function compares the thread IDs
.Fa t1
and
.Fa t2 .
.Sh RETURN VALUES
The
.Fn pthread_equal
function will return non-zero if the thread IDs
.Fa t1
and
.Fa t2
correspond to the same thread, otherwise it will return zero.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_exit 3
.Sh STANDARDS
The
.Fn pthread_equal
function conforms to
.St -p1003.1-96 .

View File

@ -1,105 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_EXIT 3
.Os
.Sh NAME
.Nm pthread_exit
.Nd terminate the calling thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft void
.Fn pthread_exit "void *value_ptr"
.Sh DESCRIPTION
The
.Fn pthread_exit
function terminates the calling thread and makes the value
.Fa value_ptr
available to any successful join with the terminating thread.
Any
cancellation cleanup handlers that have been pushed and are not yet popped
are popped in the reverse order that they were pushed and then executed.
After all cancellation handlers have been executed, if the thread has any
thread-specific data, appropriate destructor functions are called in an
unspecified order.
Thread termination does not release any application
visible process resources, including, but not limited to, mutexes and
file descriptors, nor does it perform any process level cleanup
actions, including, but not limited to, calling
.Fn atexit
routines that may exist.
.Pp
An implicit call to
.Fn pthread_exit
is made when a thread other than the thread in which
.Fn main
was first invoked returns from the start routine that was used to create
it. The function's return value serves as the thread's exit status.
.Pp
The behavior of
.Fn pthread_exit
is undefined if called from a cancellation handler or destructor function
that was invoked as the result of an implicit or explicit call to
.Fn pthread_exit .
.Pp
After a thread has terminated, the result of access to local (auto)
variables of the thread is undefined.
Thus, references to local variables
of the exiting thread should not be used for the
.Fn pthread_exit
.Fa value_ptr
parameter value.
.Pp
The process will exit with an exit status of 0 after the last thread has
been terminated.
The behavior is as if the implementation called
.Fn exit
with a zero argument at thread termination time.
.Sh RETURN VALUES
The
.Fn pthread_exit
function cannot return to its caller.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr _exit 2 ,
.Xr exit 3 ,
.Xr pthread_create 3 ,
.Xr pthread_join 3
.Sh STANDARDS
The
.Fn pthread_exit
function conforms to
.St -p1003.1-96 .

View File

@ -1,85 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_GETSPECIFIC 3
.Os
.Sh NAME
.Nm pthread_getspecific
.Nd get a thread-specific data value
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft void *
.Fn pthread_getspecific "pthread_key_t key"
.Sh DESCRIPTION
The
.Fn pthread_getspecific
function returns the value currently bound to the specified
.Fa key
on behalf of the calling thread.
.Pp
The effect of calling
.Fn pthread_getspecific
with a
.Fa key
value not obtained from
.Fn pthread_key_create
or after
.Fa key
has been deleted with
.Fn pthread_key_delete
is undefined.
.Pp
The
.Fn pthread_getspecific
function may be called from a thread-specific data destructor function.
.Sh RETURN VALUES
The
.Fn pthread_getspecific
function will return the thread-specific data value associated with the given
.Fa key .
If no thread-specific data value is associated with
.Fa key ,
then the value NULL is returned.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_key_create 3 ,
.Xr pthread_key_delete 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_getspecific
function conforms to
.St -p1003.1-96 .

View File

@ -1,106 +0,0 @@
.\" Copyright (c) 1996-1998 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_JOIN 3
.Os
.Sh NAME
.Nm pthread_join
.Nd wait for thread termination
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_join "pthread_t thread" "void **value_ptr"
.Sh DESCRIPTION
The
.Fn pthread_join
function suspends execution of the calling thread until the target
.Fa thread
terminates unless the target
.Fa thread
has already terminated.
.Pp
On return from a successful
.Fn pthread_join
call with a non-NULL
.Fa value_ptr
argument, the value passed to
.Fn pthread_exit
by the terminating thread is stored in the location referenced by
.Fa value_ptr .
When a
.Fn pthread_join
returns successfully, the target thread has been terminated.
The results
of multiple simultaneous calls to
.Fn pthread_join
specifying the same target thread are undefined.
If the thread calling
.Fn pthread_join
is cancelled, then the target thread is not detached.
.Pp
A thread that has exited but remains unjoined counts against
[_POSIX_THREAD_THREADS_MAX].
.Sh RETURN VALUES
If successful, the
.Fn pthread_join
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_join
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The implementation has detected that the value specified by
.Fa thread
does not refer to a joinable thread.
.It Bq Er ESRCH
No thread could be found corresponding to that specified by the given
thread ID,
.Fa thread .
.It Bq Er EDEADLK
A deadlock was detected or the value of
.Fa thread
specifies the calling thread.
.El
.Sh SEE ALSO
.Xr wait 2 ,
.Xr pthread_create 3
.Sh STANDARDS
The
.Fn pthread_join
function conforms to
.St -p1003.1-96 .

View File

@ -1,109 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_KEY_CREATE 3
.Os
.Sh NAME
.Nm pthread_key_create
.Nd thread-specific data key creation
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_key_create "pthread_key_t *key" "void (*destructor)(void *)"
.Sh DESCRIPTION
The
.Fn pthread_key_create
function creates a thread-specific data key visible to all threads in the
process.
Key values provided by
.Fn pthread_key_create
are opaque objects used to locate thread-specific data.
Although the same
key value may be used by different threads, the values bound to the key
by
.Fn pthread_setspecific
are maintained on a per-thread basis and persist for the life of the calling
thread.
.Pp
Upon key creation, the value NULL is associated with the new key in all
active threads.
Upon thread creation, the value NULL is associated with all
defined keys in the new thread.
.Pp
An optional destructor function may be associated with each key value.
At
thread exit, if a key value has a non-NULL destructor pointer, and the
thread has a non-NULL value associated with the key, the function pointed
to is called with the current associated value as its sole argument.
The
order of destructor calls is unspecified if more than one destructor exists
for a thread when it exits.
.Pp
If, after all the destructors have been called for all non-NULL values
with associated destructors, there are still some non-NULL values with
associated destructors, then the process is repeated.
If, after at least
[PTHREAD_DESTRUCTOR_ITERATIONS] iterations of destructor calls for
outstanding non-NULL values, there are still some non-NULL values with
associated destructors, the implementation stops calling destructors.
.Sh RETURN VALUES
If successful, the
.Fn pthread_key_create
function will store the newly created key value at the location specified by
.Fa key
and returns zero.
Otherwise an error number will be returned to indicate
the error.
.Sh ERRORS
The
.Fn pthread_key_create
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources to create another thread-specific
data key, or the system-imposed limit on the total number of keys per process
[PTHREAD_KEYS_MAX] would be exceeded.
.It Bq Er ENOMEM
Insufficient memory exists to create the key.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_delete 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_key_create
function conforms to
.St -p1003.1-96 .

View File

@ -1,100 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_KEY_DELETE 3
.Os
.Sh NAME
.Nm pthread_key_delete
.Nd delete a thread-specific data key
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_key_delete "pthread_key_t key"
.Sh DESCRIPTION
The
.Fn pthread_key_delete
function deletes a thread-specific data key previously returned by
.Fn pthread_key_create .
The thread-specific data values associated with
.Fa key
need not be NULL at the time that
.Fn pthread_key_delete
is called.
It is the responsibility of the application to free any
application storage or perform any cleanup actions for data structures
related to the deleted key or associated thread-specific data in any threads;
this cleanup can be done either before or after
.Fn pthread_key_delete
is called.
Any attempt to use
.Fa key
following the call to
.Fn pthread_key_delete
results in undefined behavior.
.Pp
The
.Fn pthread_key_delete
function is callable from within destructor functions.
Destructor functions
are not invoked by
.Fn pthread_key_delete .
Any destructor function that may have been associated with
.Fa key
will no longer be called upon thread exit.
.Sh RETURN VALUES
If successful, the
.Fn pthread_key_delete
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_key_delete
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa key
value is invalid.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_create 3 ,
.Xr pthread_setspecific 3
.Sh STANDARDS
The
.Fn pthread_key_delete
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 27, 2000
.Dt PTHREAD_KILL 3
.Os
.Sh NAME
.Nm pthread_kill
.Nd send a signal to a specified thread
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.In signal.h
.Ft int
.Fn pthread_kill "pthread_t thread" "int sig"
.Sh DESCRIPTION
The
.Fn pthread_kill
function sends a signal, specified by
.Fa sig ,
to a thread, specified by
.Fa thread .
If
.Fa sig
is 0, error checking is performed, but no signal is actually sent.
.Sh RETURN VALUES
If successful,
.Fn pthread_kill
returns 0.
Otherwise, an error number is returned.
.Sh ERRORS
The
.Fn pthread_kill
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
.Fa thread
is an invalid thread ID.
.It Bq Er EINVAL
.Fa sig
is an invalid or unsupported signal number.
.El
.Sh SEE ALSO
.Xr kill 2 ,
.Xr pthread_self 3 ,
.Xr raise 3
.Sh STANDARDS
The
.Fn pthread_kill
function conforms to
.St -p1003.1-96

View File

@ -1,74 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 29, 1998
.Dt PTHREAD_MUTEX_DESTROY 3
.Os
.Sh NAME
.Nm pthread_mutex_destroy
.Nd free resources allocated for a mutex
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_destroy "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_destroy
function frees the resources allocated for
.Fa mutex .
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_destroy
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EBUSY
.Fa Mutex
is locked by another thread.
.El
.Sh SEE ALSO
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_destroy
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 29, 1998
.Dt PTHREAD_MUTEX_INIT 3
.Os
.Sh NAME
.Nm pthread_mutex_init
.Nd create a mutex
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_init "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_mutex_init
function creates a new mutex, with attributes specified with
.Fa attr .
If
.Fa attr
is NULL the default attributes are used.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_init
will return zero and put the new mutex id into
.Fa mutex ,
otherwise an error number will be returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.It Bq Er ENOMEM
The process cannot allocate enough memory to create another mutex.
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_init
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_LOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_lock
.Nd lock a mutex
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_lock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_lock
function locks
.Fa mutex .
If the mutex is already locked, the calling thread will block until the
mutex becomes available.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_lock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_lock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EDEADLK
A deadlock would occur if the thread blocked waiting for
.Fa mutex .
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_trylock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_lock
function conforms to
.St -p1003.1-96 .

View File

@ -1,77 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_TRYLOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_trylock
.Nd attempt to lock a mutex without blocking
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_trylock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
The
.Fn pthread_mutex_trylock
function locks
.Fa mutex .
If the mutex is already locked,
.Fn pthread_mutex_trylock
will not block waiting for the mutex, but will return an error condition.
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_trylock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_trylock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EBUSY
.Fa Mutex
is already locked.
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_unlock 3
.Sh STANDARDS
The
.Fn pthread_mutex_trylock
function conforms to
.St -p1003.1-96 .

View File

@ -1,76 +0,0 @@
.\" Copyright (c) 1997 Brian Cully <shmit@kublai.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 30, 1998
.Dt PTHREAD_MUTEX_UNLOCK 3
.Os
.Sh NAME
.Nm pthread_mutex_unlock
.Nd unlock a mutex
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_unlock "pthread_mutex_t *mutex"
.Sh DESCRIPTION
If the current thread holds the lock on
.Fa mutex ,
then the
.Fn pthread_mutex_unlock
function unlocks
.Fa mutex .
.Sh RETURN VALUES
If successful,
.Fn pthread_mutex_unlock
will return zero, otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_mutex_unlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa mutex
is invalid.
.It Bq Er EPERM
The current thread does not hold a lock on
.Fa mutex .
.El
.Sh SEE ALSO
.Xr pthread_mutex_destroy 3 ,
.Xr pthread_mutex_init 3 ,
.Xr pthread_mutex_lock 3 ,
.Xr pthread_mutex_trylock 3
.Sh STANDARDS
The
.Fn pthread_mutex_unlock
function conforms to
.St -p1003.1-96 .

View File

@ -1,187 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd May 1, 2000
.Dt PTHREAD_MUTEXATTR 3
.Os
.Sh NAME
.Nm pthread_mutexattr_init ,
.Nm pthread_mutexattr_destroy ,
.Nm pthread_mutexattr_setprioceiling ,
.Nm pthread_mutexattr_getprioceiling ,
.Nm pthread_mutexattr_setprotocol ,
.Nm pthread_mutexattr_getprotocol ,
.Nm pthread_mutexattr_settype ,
.Nm pthread_mutexattr_gettype
.Nd mutex attribute operations
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutexattr_init "pthread_mutexattr_t *attr"
.Ft int
.Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr"
.Ft int
.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int prioceiling"
.Ft int
.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *prioceiling"
.Ft int
.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
.Ft int
.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
.Ft int
.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
.Ft int
.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
.Sh DESCRIPTION
Mutex attributes are used to specify parameters to
.Fn pthread_mutex_init .
One attribute object can be used in multiple calls to
.Fn pthread_mutex_init ,
with or without modifications between calls.
.Pp
The
.Fn pthread_mutexattr_init
function initializes
.Fa attr
with all the default mutex attributes.
.Pp
The
.Fn pthread_mutexattr_destroy
function destroys
.Fa attr .
.Pp
The
.Fn pthread_mutexattr_set*
functions set the attribute that corresponds to each function name.
.Pp
The
.Fn pthread_mutexattr_get*
functions copy the value of the attribute that corresponds to each function name
to the location pointed to by the second function parameter.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_mutexattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Out of memory.
.El
.Pp
The
.Fn pthread_mutexattr_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_setprioceiling
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa prioceiling .
.El
.Pp
The
.Fn pthread_mutexattr_getprioceiling
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_setprotocol
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa protocol .
.El
.Pp
The
.Fn pthread_mutexattr_getprotocol
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
The
.Fn pthread_mutexattr_settype
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr ,
or invalid value for
.Fa type .
.El
.Pp
The
.Fn pthread_mutexattr_gettype
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Sh SEE ALSO
.Xr pthread_mutex_init 3
.Sh STANDARDS
The
.Fn pthread_mutexattr_init
and
.Fn pthread_mutexattr_destroy
functions conform to
.St -p1003.1-96
.Pp
The
.Fn pthread_mutexattr_setprioceiling ,
.Fn pthread_mutexattr_getprioceiling ,
.Fn pthread_mutexattr_setprotocol ,
.Fn pthread_mutexattr_getprotocol ,
.Fn pthread_mutexattr_settype ,
and
.Fn pthread_mutexattr_gettype
functions conform to
.St -susv2

View File

@ -1,106 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_ONCE 3
.Os
.Sh NAME
.Nm pthread_once
.Nd dynamic package initialization
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Pp
pthread_once_t
.Fa once_control
= PTHREAD_ONCE_INIT;
.Ft int
.Fn pthread_once "pthread_once_t *once_control" "void (*init_routine)(void)"
.Sh DESCRIPTION
The first call to
.Fn pthread_once
by any thread in a process, with a given
.Fa once_control ,
will call the
.Fn init_routine
with no arguments.
Subsequent calls to
.Fn pthread_once
with the same
.Fa once_control
will not call the
.Fn init_routine .
On return from
.Fn pthread_once ,
it is guaranteed that
.Fn init_routine
has completed.
The
.Fa once_control
parameter is used to determine whether the associated initialization
routine has been called.
.Pp
The function
.Fn pthread_once
is not a cancellation point.
However, if
.Fn init_routine
is a cancellation point and is cancelled, the effect on
.Fa once_control is as if
.Fn pthread_once
was never called.
.Pp
The constant
.Fa PTHREAD_ONCE_INIT
is defined by header
.In pthread.h .
.Pp
The behavior of
.Fn pthread_once
is undefined if
.Fa once_control
has automatic storage duration or is not initialized by
.Fa PTHREAD_ONCE_INIT .
.Sh RETURN VALUES
If successful, the
.Fn pthread_once
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
None.
.Sh STANDARDS
The
.Fn pthread_once
function conforms to
.St -p1003.1-96 .

View File

@ -1,82 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_DESTROY 3
.Os
.Sh NAME
.Nm pthread_rwlock_destroy
.Nd destroy a read/write lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_destroy "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_destroy
function is used to destroy a read/write lock previously created with
.Fn pthread_rwlock_init .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_destroy
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlock_destroy
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
The caller does not have the privilege to perform the operation.
.El
.Pp
The
.Fn pthread_rwlock_destroy
function may fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The system has detected an attempt to destroy the object referenced by
.Fa lock
while it is locked.
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_destroy
function first appeared in
.Fx 3.0 .

View File

@ -1,101 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_INIT 3
.Os
.Sh NAME
.Nm pthread_rwlock_init
.Nd initialize a read/write lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_init "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_init
function is used to initialize a read/write lock, with attributes
specified by
.Fa attr .
If
.Fa attr
is NULL, the default read/write lock attributes are used.
.Pp
The results of calling
.Fn pthread_rwlock_init
with an already initialized lock are undefined.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_init
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_destroy 3
.Sh STANDARDS
The
.Fn pthread_rwlock_init
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_init
function will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacked the necessary resources (other than memory) to
initialize the lock.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock.
.It Bq Er EPERM
The caller does not have sufficient privilege to perform the
operation.
.El
.Pp
The
.Fn pthread_rwlock_init
function may fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The system has detected an attempt to re-initialize the object
referenced by
.Fa lock ,
a previously initialized but not yet destroyed read/write lock.
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_init
function first appeared in
.Fx 3.0 .
.Sh BUGS
The PTHREAD_PROCESS_SHARED attribute is not supported.

View File

@ -1,124 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_RDLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_rdlock ,
.Nm pthread_rwlock_tryrdlock
.Nd acquire a read/write lock for reading
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_rdlock
function acquires a read lock on
.Fa lock
provided that
.Fa lock
is not presently held for writing and no writer threads are
presently blocked on the lock. If the read lock cannot be
immediately acquired, the calling thread blocks until it can
acquire the lock.
.Pp
The
.Fn pthread_rwlock_tryrdlock
function performs the same action, but does not block if the lock
cannot be immediately obtained (i.e. the lock is held for writing
or there are waiting writers).
.Pp
A thread may hold multiple concurrent read locks. If so,
.Fn pthread_rwlock_unlock
must be called once for each lock obtained.
.Pp
The results of acquiring a read lock while the calling thread holds
a write lock are undefined.
.Sh IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3 ,
.Xr pthread_rwlock_trywrlock 3 ,
.Xr pthread_rwlock_unlock 3 ,
.Xr pthread_rwlock_wrlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions are expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_tryrdlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The lock could not be acquired because a writer holds the lock or
was blocked on it.
.El
.Pp
The
.Fn pthread_rwlock_rdlock
and
.Fn pthread_rwlock_tryrdlock
functions may fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The lock could not be acquired because the maximum number of read locks
against
.Fa lock
has been exceeded.
.It Bq Er EDEADLK
The current thread already owns
.Fa lock
for writing.
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock (applies to
statically initialized locks only).
.El
.Sh HISTORY
The
.Fn pthread_rwlock_rdlock
function first appeared in
.Fx 3.0 .

View File

@ -1,81 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_UNLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_unlock
.Nd release a read/write lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_unlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_unlock
function is used to release the read/write lock previously obtained by
.Fn pthread_rwlock_rdlock ,
.Fn pthread_rwlock_wrlock ,
.Fn pthread_rwlock_tryrdlock ,
or
.Fn pthread_rwlock_trywrlock .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_unlock
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Pp
The results are undefined if
.Fa lock
is not held by the calling thread.
.Sh SEE ALSO
.Xr pthread_rwlock_rdlock 3 ,
.Xr pthread_rwlock_wrlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_unlock
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_unlock
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er EPERM
The current thread does not own the read/write lock.
.El
.Sh HISTORY
The
.Fn pthread_rwlock_unlock
function first appeared in
.Fx 3.0 .

View File

@ -1,105 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCK_WRLOCK 3
.Os
.Sh NAME
.Nm pthread_rwlock_wrlock ,
.Nm pthread_rwlock_trywrlock
.Nd acquire a read/write lock for writing
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_wrlock
function blocks until a write lock can be acquired against
.Fa lock .
The
.Fn pthread_rwlock_trywrlock
function performs the same action, but does not block if the lock
cannot be immediately obtained.
.Pp
The results are undefined if the calling thread already holds the
lock at the time the call is made.
.Sh IMPLEMENTATION NOTES
To prevent writer starvation, writers are favored over readers.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlock_init 3 ,
.Xr pthread_rwlock_rdlock 3 ,
.Xr pthread_rwlock_tryrdlock 3 ,
.Xr pthread_rwlock_unlock 3
.Sh STANDARDS
The
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions are expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlock_trywrlock
function will fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The calling thread is not able to acquire the lock without blocking.
.El
.Pp
The
.Fn pthread_rwlock_wrlock
and
.Fn pthread_rwlock_trywrlock
functions may fail if:
.Bl -tag -width Er
.It Bq Er EDEADLK
The calling thread already owns the read/write lock (for reading
or writing).
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.It Bq Er ENOMEM
Insufficient memory exists to initialize the lock (applies to
statically initialized locks only).
.El
.Sh HISTORY
The
.Fn pthread_rwlock_wrlock
function first appeared in
.Fx 3.0 .

View File

@ -1,71 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_DESTROY 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_destroy
.Nd destroy a read/write lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_destroy "pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_destroy
function is used to destroy a read/write lock attribute object
previously created with
.Fn pthread_rwlockattr_init .
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_destroy
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_destroy
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_destroy
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_destroy
function first appeared in
.Fx 3.0 .

View File

@ -1,83 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd March 22, 1999
.Dt PTHREAD_RWLOCKATTR_GETPSHARED 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_getpshared
.Nd get the process shared attribute
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_getpshared "const pthread_rwlockattr_t *attr" "int *pshared"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_getpshared
function is used to get the process shared setting of a read/write
lock attribute object. The setting is returned via
.Fa pshared ,
and may be one of two values:
.Bl -tag -width PTHREAD_PROCESS_PRIVATE
.It Dv PTHREAD_PROCESS_SHARED
Any thread of any process that has access to the memory where the
read/write lock resides can manipulate the lock.
.It Dv PTHREAD_PROCESS_PRIVATE
Only threads created within the same process as the thread that
initialized the read/write lock can manipulate the lock. This is
the default value.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_getpshared
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_getpshared
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_getpshared
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_getpshared
function first appeared in
.Fx 3.0 .

View File

@ -1,70 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_INIT 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_init
.Nd initialize a read/write lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_init "pthread_rwlockattr_t *attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_init
function is used to initialize a read/write lock attributes object.
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_init
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_destroy 3 ,
.Xr pthread_rwlockattr_getpshared 3 ,
.Xr pthread_rwlockattr_setpshared 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_init
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_init
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficient memory exists to initialize the attribute object.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_init
function first appeared in
.Fx 3.0 .

View File

@ -1,92 +0,0 @@
.\" Copyright (c) 1998 Alex Nash
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd August 4, 1998
.Dt PTHREAD_RWLOCKATTR_SETPSHARED 3
.Os
.Sh NAME
.Nm pthread_rwlockattr_setpshared
.Nd set the process shared attribute
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlockattr_setpshared "pthread_rwlockattr_t *attr" "int pshared"
.Sh DESCRIPTION
The
.Fn pthread_rwlockattr_setpshared
function sets the process shared attribute of
.Fa attr
to the value referenced by
.Fa pshared .
The
.Fa pshared
argument may be one of two values:
.Bl -tag -width PTHREAD_PROCESS_PRIVATE
.It Dv PTHREAD_PROCESS_SHARED
Any thread of any process that has access to the memory where the
read/write lock resides can manipulate the lock.
.It Dv PTHREAD_PROCESS_PRIVATE
Only threads created within the same process as the thread that
initialized the read/write lock can manipulate the lock. This is
the default value.
.El
.Sh RETURN VALUES
If successful, the
.Fn pthread_rwlockattr_setpshared
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh SEE ALSO
.Xr pthread_rwlockattr_getpshared 3 ,
.Xr pthread_rwlockattr_init 3 ,
.Xr pthread_rwlock_init 3
.Sh STANDARDS
The
.Fn pthread_rwlockattr_setpshared
function is expected to conform to
.St -susv2 .
.Sh ERRORS
The
.Fn pthread_rwlockattr_setpshared
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
or
.Fa pshared
is invalid.
.El
.Sh HISTORY
The
.Fn pthread_rwlockattr_setpshared
function first appeared in
.Fx 3.0 .
.Sh BUGS
The
.Dv PTHREAD_PROCESS_SHARED
attribute is not supported.

View File

@ -1,93 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd May 1, 2000
.Dt PTHREAD_SCHEDPARAM 3
.Os
.Sh NAME
.Nm pthread_setschedparam ,
.Nm pthread_getschedparam
.Nd thread scheduling parameter manipulation
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
.Ft int
.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
.Sh DESCRIPTION
The
.Fn pthread_setschedparam
and
.Fn pthread_getschedparam
functions set and get the scheduling parameters of individual threads.
The scheduling policy for a thread can either be
.Dv SCHED_FIFO
(first in, first out) or
.Dv SCHED_RR
(round-robin).
The thread priority (accessed via
.Va param->sched_priority )
must be at least
.Dv PTHREAD_MIN_PRIORITY
and no more than
.Dv PTHREAD_MAX_PRIORITY .
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh ERRORS
The
.Fn pthread_setschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
Invalid value for
.Va policy .
.It Bq Er ENOTSUP
Invalid value for scheduling parameters.
.It Bq Er ESRCH
Non-existent thread
.Va thread .
.El
.Pp
The
.Fn pthread_getschedparam
function will fail if:
.Bl -tag -width Er
.It Bq Er ESRCH
Non-existent thread
.Va thread .
.El
.Sh STANDARDS
The
.Fn pthread_setschedparam
and
.Fn pthread_getschedparam
functions conform to
.St -susv2

View File

@ -1,62 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_SELF 3
.Os
.Sh NAME
.Nm pthread_self
.Nd get the calling thread's ID
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft pthread_t
.Fn pthread_self "void"
.Sh DESCRIPTION
The
.Fn pthread_self
function returns the thread ID of the calling thread.
.Sh RETURN VALUES
The
.Fn pthread_self
function returns the thread ID of the calling thread.
.Sh ERRORS
None.
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_equal 3
.Sh STANDARDS
The
.Fn pthread_self
function conforms to
.St -p1003.1-96 .

View File

@ -1,98 +0,0 @@
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_SETSPECIFIC 3
.Os
.Sh NAME
.Nm pthread_setspecific
.Nd set a thread-specific data value
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setspecific "pthread_key_t key" "const void *value"
.Sh DESCRIPTION
The
.Fn pthread_setspecific
function associates a thread-specific value with a
.Fa key
obtained via a previous call to
.Fn pthread_key_create .
Different threads man bind different values to the same key.
These values are
typically pointers to blocks of dynamically allocated memory that have been
reserved for use by the calling thread.
.Pp
The effect of calling
.Fn pthread_setspecific
with a key value not obtained from
.Fn pthread_key_create
or after
.Fa key
has been deleted with
.Fn pthread_key_delete
is undefined.
.Pp
The
.Fn pthread_setspecific
function may be called from a thread-specific data destructor function,
however this may result in lost storage or infinite loops.
.Sh RETURN VALUES
If successful, the
.Fn pthread_setspecific
function will return zero.
Otherwise an error number will be returned to
indicate the error.
.Sh ERRORS
The
.Fn pthread_setspecific
function will fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficient memory exists to associate the value with the
.Fa key .
.It Bq Er EINVAL
The
.Fa key
value is invalid.
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_create 3 ,
.Xr pthread_key_delete 3
.Sh STANDARDS
The
.Fn pthread_setspecific
function conforms to
.St -p1003.1-96 .

View File

@ -1,98 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd April 27, 2000
.Dt PTHREAD_SIGMASK 3
.Os
.Sh NAME
.Nm pthread_sigmask
.Nd examine and/or change a thread's signal mask
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.In signal.h
.Ft int
.Fn pthread_sigmask "int how" "const sigset_t *set" "sigset_t *oset"
.Sh DESCRIPTION
The
.Fn pthread_sigmask
function examines and/or changes the calling thread's signal mask.
.Pp
If
.Fa set
is not
.Dv NULL ,
it specifies a set of signals to be modified, and
.Fa how
specifies what to set the signal mask to:
.Bl -tag -width SIG_UNBLOCK
.It Dv SIG_BLOCK
Union of the current mask and
.Fa set .
.It Dv SIG_UNBLOCK
Intersection of the current mask and the complement of
.Fa set .
.It Dv SIG_SETMASK
.Fa set .
.El
.Pp
If
.Fa oset
is not NULL, the previous signal mask is stored in the location pointed to by
.Fa oset .
.Pp
.Dv SIGKILL
and
.Dv SIGSTOP
cannot be blocked, and will be silently ignored if included in the signal mask.
.Sh RETURN VALUES
If successful,
.Fn pthread_sigmask
returns 0.
Otherwise, an error is returned.
.Sh ERRORS
The
.Fn pthread_sigmask
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa how
is not one of the defined values.
.El
.Sh SEE ALSO
.Xr sigaction 2 ,
.Xr sigpending 2 ,
.Xr sigprocmask 2 ,
.Xr sigsuspend 2 ,
.Xr sigsetops 3
.Sh STANDARDS
The
.Fn pthread_sigmask
function conforms to
.St -p1003.1-96

View File

@ -1,210 +0,0 @@
.\" $FreeBSD$
.Dd January 17, 1999
.Dt PTHREAD_TESTCANCEL 3
.Os
.Sh NAME
.Nm pthread_setcancelstate ,
.Nm pthread_setcanceltype ,
.Nm pthread_testcancel
.Nd set cancelability state
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_setcancelstate "int state" "int *oldstate"
.Ft int
.Fn pthread_setcanceltype "int type" "int *oldtype"
.Ft void
.Fn pthread_testcancel "void"
.Sh DESCRIPTION
The
.Fn pthread_setcancelstate
function atomically both sets the calling thread's cancelability state
to the indicated
.Fa state
and, if
.Fa oldstate
is not
.Dv NULL ,
returns the previous cancelability state at the location referenced by
.Fa oldstate .
Legal values for
.Fa state
are
.Dv PTHREAD_CANCEL_ENABLE
and
.Dv PTHREAD_CANCEL_DISABLE .
.Pp
The
.Fn pthread_setcanceltype
function atomically both sets the calling thread's cancelability type
to the indicated
.Fa type
and, if
.Fa oldtype
is not
.Dv NULL ,
returns the previous cancelability type at the location referenced by
.Fa oldtype .
Legal values for
.Fa type
are
.Dv PTHREAD_CANCEL_DEFERRED
and
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
.Pp
The cancelability state and type of any newly created threads, including the
thread in which
.Fn main
was first invoked, are
.Dv PTHREAD_CANCEL_ENABLE
and
.Dv PTHREAD_CANCEL_DEFERRED
respectively.
.Pp
The
.Fn pthread_testcancel
function creates a cancellation point in the calling thread.
The
.Fn pthread_testcancel
function has no effect if cancelability is disabled.
.Pp
.Ss Cancelability States
The cancelability state of a thread determines the action taken upon
receipt of a cancellation request.
The thread may control cancellation in
a number of ways.
.Pp
Each thread maintains its own
.Dq cancelability state
which may be encoded in two bits:
.Bl -hang
.It Em Cancelability Enable
When cancelability is
.Dv PTHREAD_CANCEL_DISABLE ,
cancellation requests against the target thread are held pending.
.It Em Cancelability Type
When cancelability is enabled and the cancelability type is
.Dv PTHREAD_CANCEL_ASYNCHRONOUS ,
new or pending cancellation requests may be acted upon at any time.
When cancelability is enabled and the cancelability type is
.Dv PTHREAD_CANCEL_DEFERRED ,
cancellation requests are held pending until a cancellation point (see
below) is reached.
If cancelability is disabled, the setting of the
cancelability type has no immediate effect as all cancellation requests
are held pending; however, once cancelability is enabled again the new
type will be in effect.
.El
.Ss Cancellation Points
Cancellation points will occur when a thread is executing the following
functions:
.Fn close ,
.Fn creat ,
.Fn fcntl ,
.Fn fsync ,
.Fn msync ,
.Fn nanosleep ,
.Fn open ,
.Fn pause ,
.Fn pthread_cond_timedwait ,
.Fn pthread_cond_wait ,
.Fn pthread_join ,
.Fn pthread_testcancel ,
.Fn read ,
.Fn sigwaitinfo ,
.Fn sigsuspend ,
.Fn sigwait ,
.Fn sleep ,
.Fn system ,
.Fn tcdrain ,
.Fn wait ,
.Fn waitpid ,
.Fn write .
.Sh RETURN VALUES
If successful, the
.Fn pthread_setcancelstate
and
.Fn pthread_setcanceltype
functions will return zero.
Otherwise, an error number shall be returned to
indicate the error.
.Pp
The
.Fn pthread_setcancelstate
and
.Fn pthread_setcanceltype
functions are used to control the points at which a thread may be
asynchronously canceled.
For cancellation control to be usable in modular
fashion, some rules must be followed.
.Pp
For purposes of this discussion, consider an object to be a generalization
of a procedure.
It is a set of procedures and global variables written as
a unit and called by clients not known by the object.
Objects may depend
on other objects.
.Pp
First, cancelability should only be disabled on entry to an object, never
explicitly enabled.
On exit from an object, the cancelability state should
always be restored to its value on entry to the object.
.Pp
This follows from a modularity argument: if the client of an object (or the
client of an object that uses that object) has disabled cancelability, it is
because the client doesn't want to have to worry about how to clean up if the
thread is canceled while executing some sequence of actions.
If an object
is called in such a state and it enables cancelability and a cancellation
request is pending for that thread, then the thread will be canceled,
contrary to the wish of the client that disabled.
.Pp
Second, the cancelability type may be explicitly set to either
.Em deferred
or
.Em asynchronous
upon entry to an object.
But as with the cancelability state, on exit from
an object that cancelability type should always be restored to its value on
entry to the object.
.Pp
Finally, only functions that are cancel-safe may be called from a thread that
is asynchronously cancelable.
.Sh ERRORS
The function
.Fn pthread_setcancelstate
may fail with:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified state is not
.Dv PTHREAD_CANCEL_ENABLE
or
.Dv PTHREAD_CANCEL_DISABLE .
.El
.Pp
The function
.Fn pthread_setcanceltype
may fail with:
.Bl -tag -width Er
.It Bq Er EINVAL
The specified state is not
.Dv PTHREAD_CANCEL_DEFERRED
or
.Dv PTHREAD_CANCEL_ASYNCHRONOUS .
.El
.Sh SEE ALSO
.Xr pthread_cancel 3
.Sh STANDARDS
The
.Fn pthread_testcancel
function conforms to
.St -p1003.1-96 .
.Sh AUTHORS
This man page was written by
.An David Leonard Aq d@openbsd.org
for the
.Ox
implementation of
.Xr pthread_cancel 3 .

View File

@ -1,84 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd February 15, 2000
.Dt SEM_DESTROY 3
.Os
.Sh NAME
.Nm sem_destroy
.Nd destroy an unnamed semaphore
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In semaphore.h
.Ft int
.Fn sem_destroy "sem_t *sem"
.Sh DESCRIPTION
The
.Fn sem_destroy
function destroys the unnamed semaphore pointed to by
.Fa sem .
After a successful call to
.Fn sem_destroy ,
.Fa sem
is unusable until re-initialized by another call to
.Fn sem_init .
.Sh RETURN VALUES
.Rv -std sem_destroy
.Sh ERRORS
The
.Fn sem_destroy
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa sem
points to an invalid semaphore.
.It Bq Er EBUSY
There are currently threads blocked on the semaphore that
.Fa sem
points to.
.El
.Sh SEE ALSO
.Xr sem_init 3 ,
.Xr sem 4
.Sh STANDARDS
The
.Fn sem_destroy
function conforms to
.St -p1003.1-96 .
.Pp
POSIX does not define the behavior of
.Fn sem_destroy
if called while there are threads blocked on
.Fa sem ,
but this implementation is guaranteed to return -1 and set
.Va errno
to
.Er EBUSY
if there are threads blocked on
.Fa sem .

View File

@ -1,76 +0,0 @@
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.Dd February 15, 2000
.Dt SEM_GETVALUE 3
.Os
.Sh NAME
.Nm sem_getvalue
.Nd get the value of a semaphore
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In semaphore.h
.Ft int
.Fn sem_getvalue "sem_t * restrict sem" "int * restrict sval"
.Sh DESCRIPTION
The
.Fn sem_getvalue
function sets the variable pointed to by
.Fa sval
to the current value of the semaphore pointed to by
.Fa sem ,
as of the time that the call to
.Fn sem_getvalue
is actually run.
.Sh RETURN VALUES
.Rv -std sem_getvalue
.Sh ERRORS
The
.Fn sem_getvalue
function will fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
.Fa sem
points to an invalid semaphore.
.El
.Sh SEE ALSO
.Xr sem_post 3 ,
.Xr sem_trywait 3 ,
.Xr sem_wait 3 ,
.Xr sem 4
.Sh STANDARDS
The
.Fn sem_getvalue
function conforms to
.St -p1003.1-96 .
.Pp
The value of the semaphore is never negative, even if there are threads blocked
on the semaphore. POSIX is somewhat ambiguous in its wording with regard to
what the value of the semaphore should be if there are blocked waiting threads,
but this behavior is conformant, given the wording of the specification.

Some files were not shown because too many files have changed in this diff Show More