From 15acf97d0475de2108f76813e989f0d1d4c8ad03 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Fri, 10 Jul 2009 04:16:40 +0200 Subject: [PATCH] pthread*.3: Sync the pthread manpages with FreeBSD. Brings in some missing pages and some small fixes. Reminded-by: hasso --- lib/libpthread/Makefile | 28 +++- lib/libpthread/pthread.3 | 136 ++++++++++------- lib/libpthread/pthread_atfork.3 | 117 +++++++++++++++ lib/libpthread/pthread_attr.3 | 35 +++-- lib/libpthread/pthread_attr_get_np.3 | 7 +- .../pthread_attr_setcreatesuspend_np.3 | 6 +- lib/libpthread/pthread_barrier_destroy.3 | 140 ++++++++++++++++++ lib/libpthread/pthread_barrierattr.3 | 135 +++++++++++++++++ lib/libpthread/pthread_cancel.3 | 14 +- lib/libpthread/pthread_cleanup_pop.3 | 10 +- lib/libpthread/pthread_cleanup_push.3 | 10 +- lib/libpthread/pthread_cond_broadcast.3 | 10 +- lib/libpthread/pthread_cond_destroy.3 | 10 +- lib/libpthread/pthread_cond_init.3 | 11 +- lib/libpthread/pthread_cond_signal.3 | 10 +- lib/libpthread/pthread_cond_timedwait.3 | 16 +- lib/libpthread/pthread_cond_wait.3 | 16 +- lib/libpthread/pthread_condattr.3 | 17 ++- lib/libpthread/pthread_create.3 | 16 +- lib/libpthread/pthread_detach.3 | 16 +- lib/libpthread/pthread_equal.3 | 7 +- lib/libpthread/pthread_exit.3 | 10 +- lib/libpthread/pthread_getconcurrency.3 | 4 +- lib/libpthread/pthread_getspecific.3 | 10 +- lib/libpthread/pthread_join.3 | 12 +- lib/libpthread/pthread_key_create.3 | 10 +- lib/libpthread/pthread_key_delete.3 | 10 +- lib/libpthread/pthread_kill.3 | 12 +- lib/libpthread/pthread_main_np.3 | 4 +- lib/libpthread/pthread_multi_np.3 | 4 +- lib/libpthread/pthread_mutex_destroy.3 | 10 +- lib/libpthread/pthread_mutex_init.3 | 13 +- lib/libpthread/pthread_mutex_lock.3 | 10 +- ...mutex_lock.3 => pthread_mutex_timedlock.3} | 78 ++++++---- lib/libpthread/pthread_mutex_trylock.3 | 10 +- lib/libpthread/pthread_mutex_unlock.3 | 10 +- lib/libpthread/pthread_mutexattr.3 | 38 +++-- lib/libpthread/pthread_mutexattr_getkind_np.3 | 4 +- lib/libpthread/pthread_once.3 | 9 +- lib/libpthread/pthread_resume_all_np.3 | 4 +- lib/libpthread/pthread_resume_np.3 | 4 +- lib/libpthread/pthread_rwlock_destroy.3 | 7 +- lib/libpthread/pthread_rwlock_init.3 | 7 +- lib/libpthread/pthread_rwlock_rdlock.3 | 15 +- lib/libpthread/pthread_rwlock_timedrdlock.3 | 118 +++++++++++++++ lib/libpthread/pthread_rwlock_timedwrlock.3 | 108 ++++++++++++++ lib/libpthread/pthread_rwlock_unlock.3 | 7 +- lib/libpthread/pthread_rwlock_wrlock.3 | 14 +- lib/libpthread/pthread_rwlockattr_destroy.3 | 10 +- .../pthread_rwlockattr_getpshared.3 | 18 ++- lib/libpthread/pthread_rwlockattr_init.3 | 10 +- .../pthread_rwlockattr_setpshared.3 | 20 ++- lib/libpthread/pthread_schedparam.3 | 41 +++-- lib/libpthread/pthread_self.3 | 7 +- lib/libpthread/pthread_set_name_np.3 | 4 +- lib/libpthread/pthread_setspecific.3 | 19 ++- lib/libpthread/pthread_sigmask.3 | 12 +- ...ad_rwlock_wrlock.3 => pthread_spin_init.3} | 129 +++++++++------- lib/libpthread/pthread_spin_lock.3 | 124 ++++++++++++++++ lib/libpthread/pthread_suspend_all_np.3 | 4 +- lib/libpthread/pthread_suspend_np.3 | 4 +- lib/libpthread/pthread_switch_add_np.3 | 4 +- lib/libpthread/pthread_testcancel.3 | 11 +- lib/libpthread/pthread_yield.3 | 30 ++++ 64 files changed, 1373 insertions(+), 383 deletions(-) create mode 100644 lib/libpthread/pthread_atfork.3 create mode 100644 lib/libpthread/pthread_barrier_destroy.3 create mode 100644 lib/libpthread/pthread_barrierattr.3 copy lib/libpthread/{pthread_mutex_lock.3 => pthread_mutex_timedlock.3} (50%) create mode 100644 lib/libpthread/pthread_rwlock_timedrdlock.3 create mode 100644 lib/libpthread/pthread_rwlock_timedwrlock.3 copy lib/libpthread/{pthread_rwlock_wrlock.3 => pthread_spin_init.3} (50%) create mode 100644 lib/libpthread/pthread_spin_lock.3 create mode 100644 lib/libpthread/pthread_yield.3 diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index e29e743300..f6d2046515 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -10,9 +10,12 @@ WARNS?= 6 MAN+= \ pthread.3 \ + pthread_atfork.3 \ pthread_attr.3 \ pthread_attr_get_np.3 \ pthread_attr_setcreatesuspend_np.3 \ + pthread_barrier_destroy.3 \ + pthread_barrierattr.3 \ pthread_cancel.3 \ pthread_cleanup_pop.3 \ pthread_cleanup_push.3 \ @@ -40,29 +43,35 @@ MAN+= \ pthread_mutex_destroy.3 \ pthread_mutex_init.3 \ pthread_mutex_lock.3 \ + pthread_mutex_timedlock.3 \ pthread_mutex_trylock.3 \ pthread_mutex_unlock.3 \ pthread_once.3 \ pthread_resume_all_np.3 \ pthread_resume_np.3 \ + pthread_rwlockattr_destroy.3 \ + pthread_rwlockattr_getpshared.3 \ + pthread_rwlockattr_init.3 \ + pthread_rwlockattr_setpshared.3 \ pthread_rwlock_destroy.3 \ pthread_rwlock_init.3 \ pthread_rwlock_rdlock.3 \ + pthread_rwlock_timedrdlock.3 \ + pthread_rwlock_timedwrlock.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_spin_init.3 \ + pthread_spin_lock.3 \ pthread_suspend_all_np.3 \ pthread_suspend_np.3 \ pthread_switch_add_np.3 \ pthread_testcancel.3 \ + pthread_yield.3 \ sem_destroy.3 \ sem_getvalue.3 \ sem_init.3 \ @@ -92,9 +101,15 @@ MLINKS+= \ 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_barrierattr.3 pthread_barrierattr_destroy.3 \ + pthread_barrierattr.3 pthread_barrierattr_getpshared.3 \ + pthread_barrierattr.3 pthread_barrierattr_init.3 \ + pthread_barrierattr.3 pthread_barrierattr_setpshared.3 \ + pthread_barrier_destroy.3 pthread_barrier_init.3 \ + pthread_barrier_destroy.3 pthread_barrier_wait.3 \ pthread_condattr.3 pthread_condattr_init.3 \ pthread_condattr.3 pthread_condattr_destroy.3 \ + pthread_getconcurrency.3 pthread_setconcurrency.3 \ pthread_multi_np.3 pthread_single_np.3 \ pthread_mutexattr.3 pthread_mutexattr_init.3 \ pthread_mutexattr.3 pthread_mutexattr_destroy.3 \ @@ -109,6 +124,9 @@ MLINKS+= \ pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 \ pthread_schedparam.3 pthread_getschedparam.3 \ pthread_schedparam.3 pthread_setschedparam.3 \ + pthread_spin_init.3 pthread_spin_destroy.3 \ + pthread_spin_lock.3 pthread_spin_trylock.3 \ + pthread_spin_lock.3 pthread_spin_unlock.3 \ pthread_switch_add_np.3 pthread_switch_delete_np.3 \ pthread_testcancel.3 pthread_setcancelstate.3 \ pthread_testcancel.3 pthread_setcanceltype.3 \ diff --git a/lib/libpthread/pthread.3 b/lib/libpthread/pthread.3 index b462cb250e..bfc47559cd 100644 --- a/lib/libpthread/pthread.3 +++ b/lib/libpthread/pthread.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man3/pthread.3,v 1.12.2.6 2002/03/25 08:28:18 maxim Exp $ +.\" $FreeBSD: src/share/man/man3/pthread.3,v 1.33 2009/04/01 08:08:25 trhodes Exp $ .\" $DragonFly: src/share/man/man3/pthread.3,v 1.5 2007/09/14 19:47:03 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD 3 .Os .Sh NAME @@ -44,14 +44,15 @@ .Sh DESCRIPTION POSIX threads are a set of functions that support applications with requirements for multiple flows of control, called -.Fa threads , +.Em threads , within a process. Multithreading is used to improve the performance of a program. .Pp The POSIX thread functions are summarized in this section in the following groups: -.Bl -bullet -offset indent +.Pp +.Bl -bullet -offset indent -compact .It Thread Routines .It @@ -67,11 +68,14 @@ Per-Thread Context Routines .It Cleanup Routines .El -.Sh THREAD ROUTINES -.Bl -tag -width Er +.Ss Thread Routines +.Bl -tag -width indent .It Xo .Ft int -.Fn pthread_create "pthread_t *thread" "const pthread_attr_t *attr" "void *(*start_routine)(void *)" "void *arg" +.Fo pthread_create +.Fa "pthread_t *thread" "const pthread_attr_t *attr" +.Fa "void *\*[lp]*start_routine\*[rp]\*[lp]void *\*[rp]" "void *arg" +.Fc .Xc Creates a new thread of execution. .It Xo @@ -106,7 +110,7 @@ Causes the calling thread to wait for the termination of the specified thread. Delivers a signal to a specified thread. .It Xo .Ft int -.Fn pthread_once "pthread_once_t *once_control" "void (*init_routine)(void)" +.Fn pthread_once "pthread_once_t *once_control" "void \*[lp]*init_routine\*[rp]\*[lp]void\*[rp]" .Xc Calls an initialization routine once. .It Xo @@ -135,8 +139,8 @@ Creates a cancellation point in the calling thread. .Xc Allows the scheduler to run another thread instead of the current one. .El -.Sh ATTRIBUTE OBJECT ROUTINES -.Bl -tag -width Er +.Ss Attribute Object Routines +.Bl -tag -width indent .It Xo .Ft int .Fn pthread_attr_destroy "pthread_attr_t *attr" @@ -144,12 +148,16 @@ Allows the scheduler to run another thread instead of the current one. Destroy a thread attributes object. .It Xo .Ft int -.Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched" +.Fo pthread_attr_getinheritsched +.Fa "const pthread_attr_t *attr" "int *inheritsched" +.Fc .Xc Get the inherit scheduling attribute from a thread attributes object. .It Xo .Ft int -.Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param" +.Fo pthread_attr_getschedparam +.Fa "const pthread_attr_t *attr" "struct sched_param *param" +.Fc .Xc Get the scheduling parameter attribute from a thread attributes object. .It Xo @@ -189,7 +197,9 @@ Initialize a thread attributes object with default values. Set the inherit scheduling attribute in a thread attributes object. .It Xo .Ft int -.Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param" +.Fo pthread_attr_setschedparam +.Fa "pthread_attr_t *attr" "const struct sched_param *param" +.Fc .Xc Set the scheduling parameter attribute in a thread attributes object. .It Xo @@ -218,8 +228,8 @@ Set the stack address attribute in a thread attributes object. .Xc Set the detach state in a thread attributes object. .El -.Sh MUTEX ROUTINES -.Bl -tag -width Er +.Ss Mutex Routines +.Bl -tag -width indent .It Xo .Ft int .Fn pthread_mutexattr_destroy "pthread_mutexattr_t *attr" @@ -267,7 +277,9 @@ Set the mutex type attribute that is used when a mutex is created. Destroy a mutex. .It Xo .Ft int -.Fn pthread_mutex_init "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr" +.Fo pthread_mutex_init +.Fa "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr" +.Fc .Xc Initialize a mutex with specified attributes. .It Xo @@ -277,9 +289,16 @@ Initialize a mutex with specified attributes. Lock a mutex and block until it becomes available. .It Xo .Ft int +.Fo pthread_mutex_timedlock +.Fa "pthread_mutex_t *mutex" "const struct timespec *abstime" +.Fc +.Xc +Lock a mutex and block until it becomes available or until the timeout expires. +.It Xo +.Ft int .Fn pthread_mutex_trylock "pthread_mutex_t *mutex" .Xc -Try to lock a mutex, but don't block if the mutex is locked by another thread, +Try to lock a mutex, but do not block if the mutex is locked by another thread, including the current thread. .It Xo .Ft int @@ -287,8 +306,8 @@ including the current thread. .Xc Unlock a mutex. .El -.Sh CONDITION VARIABLE ROUTINES -.Bl -tag -width Er +.Ss Condition Variable Routines +.Bl -tag -width indent .It Xo .Ft int .Fn pthread_condattr_destroy "pthread_condattr_t *attr" @@ -321,17 +340,21 @@ Initialize a condition variable with specified attributes. Unblock at least one of the threads blocked on the specified condition variable. .It Xo .Ft int -.Fn pthread_cond_timedwait "pthread_cond_t *cond" "pthread_mutex_t *mutex" "const struct timespec *abstime" +.Fo pthread_cond_timedwait +.Fa "pthread_cond_t *cond" "pthread_mutex_t *mutex" +.Fa "const struct timespec *abstime" +.Fc .Xc -Wait no longer than the specified time for a condition and lock the specified mutex. +Wait no longer than the specified time for a condition +and lock the specified mutex. .It Xo .Ft int .Fn pthread_cond_wait "pthread_cond_t *" "pthread_mutex_t *mutex" .Xc Wait for a condition and lock the specified mutex. .El -.Sh READ/WRITE LOCK ROUTINES -.Bl -tag -width Er +.Ss Read/Write Lock Routines +.Bl -tag -width indent .It Xo .Ft int .Fn pthread_rwlock_destroy "pthread_rwlock_t *lock" @@ -339,7 +362,9 @@ Wait for a condition and lock the specified mutex. Destroy a read/write lock object. .It Xo .Ft int -.Fn pthread_rwlock_init "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr" +.Fo pthread_rwlock_init +.Fa "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr" +.Fc .Xc Initialize a read/write lock object. .It Xo @@ -378,7 +403,9 @@ acquired. Destroy a read/write lock attribute object. .It Xo .Ft int -.Fn pthread_rwlockattr_getpshared "const pthread_rwlockattr_t *attr" "int *pshared" +.Fo pthread_rwlockattr_getpshared +.Fa "const pthread_rwlockattr_t *attr" "int *pshared" +.Fc .Xc Retrieve the process shared setting for the read/write lock attribute object. @@ -393,11 +420,11 @@ Initialize a read/write lock attribute object. .Xc Set the process shared setting for the read/write lock attribute object. .El -.Sh PER-THREAD CONTEXT ROUTINES -.Bl -tag -width Er +.Ss Per-Thread Context Routines +.Bl -tag -width indent .It Xo .Ft int -.Fn pthread_key_create "pthread_key_t *key" "void (*routine)(void *)" +.Fn pthread_key_create "pthread_key_t *key" "void \*[lp]*routine\*[rp]\*[lp]void *\*[rp]" .Xc Create a thread-specific data key. .It Xo @@ -416,8 +443,17 @@ Get the thread-specific value for the specified key. .Xc Set the thread-specific value for the specified key. .El -.Sh CLEANUP ROUTINES -.Bl -tag -width Er +.Ss Cleanup Routines +.Bl -tag -width indent +.It Xo +.Ft int +.Fo pthread_atfork +.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]" +.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]" +.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]" +.Fc +.Xc +Register fork handlers .It Xo .Ft void .Fn pthread_cleanup_pop "int execute" @@ -426,12 +462,12 @@ Remove the routine at the top of the calling thread's cancellation cleanup stack and optionally invoke it. .It Xo .Ft void -.Fn pthread_cleanup_push "void (*routine)(void *)" "void *routine_arg" +.Fn pthread_cleanup_push "void \*[lp]*routine\*[rp]\*[lp]void *\*[rp]" "void *routine_arg" .Xc Push the specified cancellation cleanup handler onto the calling thread's cancellation stack. .El -.Sh INSTALLATION +.Sh IMPLEMENTATION NOTES The current .Dx POSIX thread implementation is built in the library @@ -461,16 +497,18 @@ links a threaded process against instead of .Fa libc . .Sh SEE ALSO +.Xr pthread_atfork 3 , +.Xr pthread_cancel 3 , .Xr pthread_cleanup_pop 3 , .Xr pthread_cleanup_push 3 , +.Xr pthread_condattr_destroy 3 , +.Xr pthread_condattr_init 3 , .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 , .Xr pthread_cond_wait 3 , -.Xr pthread_condattr_destroy 3 , -.Xr pthread_condattr_init 3 , .Xr pthread_create 3 , .Xr pthread_detach 3 , .Xr pthread_equal 3 , @@ -479,11 +517,6 @@ instead of .Xr pthread_join 3 , .Xr pthread_key_delete 3 , .Xr pthread_kill 3 , -.Xr pthread_mutex_destroy 3 , -.Xr pthread_mutex_init 3 , -.Xr pthread_mutex_lock 3 , -.Xr pthread_mutex_trylock 3 , -.Xr pthread_mutex_unlock 3 , .Xr pthread_mutexattr_destroy 3 , .Xr pthread_mutexattr_getprioceiling 3 , .Xr pthread_mutexattr_getprotocol 3 , @@ -492,6 +525,11 @@ instead of .Xr pthread_mutexattr_setprioceiling 3 , .Xr pthread_mutexattr_setprotocol 3 , .Xr pthread_mutexattr_settype 3 , +.Xr pthread_mutex_destroy 3 , +.Xr pthread_mutex_init 3 , +.Xr pthread_mutex_lock 3 , +.Xr pthread_mutex_trylock 3 , +.Xr pthread_mutex_unlock 3 , .Xr pthread_once 3 , .Xr pthread_rwlockattr_destroy 3 , .Xr pthread_rwlockattr_getpshared 3 , @@ -508,24 +546,22 @@ instead of .Xr pthread_setspecific 3 , .Xr pthread_testcancel 3 .Sh STANDARDS -The functions in -.Fa libc_r -with the -.Fa pthread_ +The functions with the +.Nm pthread_ prefix and not -.Fa _np +.Nm _np suffix or -.Fa pthread_rwlock +.Nm pthread_rwlock prefix conform to .St -p1003.1-96 . .Pp -The functions in libc_r with the -.Fa pthread_ +The functions with the +.Nm pthread_ prefix and -.Fa _np +.Nm _np suffix are non-portable extensions to POSIX threads. .Pp -The functions in libc_r with the -.Fa pthread_rwlock +The functions with the +.Nm pthread_rwlock prefix are extensions created by The Open Group as part of the .St -susv2 . diff --git a/lib/libpthread/pthread_atfork.3 b/lib/libpthread/pthread_atfork.3 new file mode 100644 index 0000000000..faa988fab9 --- /dev/null +++ b/lib/libpthread/pthread_atfork.3 @@ -0,0 +1,117 @@ +.\" Copyright (c) 2004 Alex Vasylenko +.\" 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. +.\" +.\" Portions of this text are reprinted and reproduced in electronic form +.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- +.\" Portable Operating System Interface (POSIX), The Open Group Base +.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of +.\" Electrical and Electronics Engineers, Inc and The Open Group. In the +.\" event of any discrepancy between this version and the original IEEE and +.\" The Open Group Standard, the original IEEE and The Open Group Standard is +.\" the referee document. The original Standard can be obtained online at +.\" http://www.opengroup.org/unix/online.html. +.\" +.\" $FreeBSD: src/share/man/man3/pthread_atfork.3,v 1.3 2005/06/16 18:46:16 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_ATFORK 3 +.Os +.Sh NAME +.Nm pthread_atfork +.Nd register fork handlers +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fo pthread_atfork +.Fa "void \*[lp]*prepare\*[rp]\*[lp]void\*[rp]" +.Fa "void \*[lp]*parent\*[rp]\*[lp]void\*[rp]" +.Fa "void \*[lp]*child\*[rp]\*[lp]void\*[rp]" +.Fc +.Sh DESCRIPTION +The +.Fn pthread_atfork +function declares fork handlers to be called before and after +.Xr fork 2 , +in the context of the thread that called +.Xr fork 2 . +.Pp +The handlers registered with +.Fn pthread_atfork +are called at the moments in time described below: +.Bl -tag -width ".Fa prepare" +.It Fa prepare +Before +.Xr fork 2 +processing commences in the parent process. +If more than one +.Fa prepare +handler is registered they will be called in the opposite order +they were registered. +.It Fa parent +After +.Xr fork 2 +completes in the parent process. +If more than one +.Fa parent +handler is registered they will be called in the same order +they were registered. +.It Fa child +After +.Xr fork 2 +processing completes in the child process. +If more than one +.Fa child +handler is registered they will be called in the same order +they were registered. +.El +.Pp +If no handling is desired at one or more of these three points, +a null pointer may be passed as the corresponding fork handler. +.Sh RETURN VALUES +If successful, the +.Fn pthread_atfork +function will return zero. +Otherwise an error number will be returned to indicate the error. +.Sh ERRORS +The +.Fn pthread_atfork +function will fail if: +.Bl -tag -width Er +.It Bq Er ENOMEM +Insufficient table space exists to record the fork handler addresses. +.El +.Sh SEE ALSO +.Xr fork 2 , +.Xr pthread 3 +.Sh STANDARDS +The +.Fn pthread_atfork +function is expected to conform to +.St -p1003.1 . +.Sh AUTHORS +This manpage was written by +.An Alex Vasylenko +.Aq lxv@omut.org . diff --git a/lib/libpthread/pthread_attr.3 b/lib/libpthread/pthread_attr.3 index 263ca536e9..8e6123664b 100644 --- a/lib/libpthread/pthread_attr.3 +++ b/lib/libpthread/pthread_attr.3 @@ -25,9 +25,9 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_attr.3,v 1.4.2.7 2003/03/04 16:51:13 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_attr.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_attr.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ -.Dd June 28, 2009 +.Dd July 10, 2009 .Dt PTHREAD_ATTR 3 .Os .Sh NAME @@ -126,15 +126,17 @@ to the location pointed to by the second function parameter. If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. .Sh ERRORS +The .Fn pthread_attr_init -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Out of memory. .El .Pp +The .Fn pthread_attr_destroy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -164,24 +166,27 @@ Invalid value for .Fa guardsize . .El .Pp +The .Fn pthread_attr_setdetachstate -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for .Fa detachstate . .El .Pp +The .Fn pthread_attr_setinheritsched -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for .Fa attr . .El .Pp +The .Fn pthread_attr_setschedparam -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -191,8 +196,9 @@ Invalid value for .Fa param . .El .Pp +The .Fn pthread_attr_setschedpolicy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -202,8 +208,9 @@ Invalid or unsupported value for .Fa policy . .El .Pp +The .Fn pthread_attr_setscope -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -216,6 +223,7 @@ Invalid or unsupported value for .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 , @@ -225,9 +233,10 @@ Invalid or unsupported value for .Fn pthread_attr_setdetachstate , and .Fn pthread_attr_getdetachstate -conform to -.St -p1003.1-96 +functions conform to +.St -p1003.1-96 . .Pp +The .Fn pthread_attr_setinheritsched , .Fn pthread_attr_getinheritsched , .Fn pthread_attr_setschedparam , @@ -237,5 +246,5 @@ conform to .Fn pthread_attr_setscope , and .Fn pthread_attr_getscope -conform to -.St -susv2 +functions conform to +.St -susv2 . diff --git a/lib/libpthread/pthread_attr_get_np.3 b/lib/libpthread/pthread_attr_get_np.3 index cf4fc26048..bcb42b33b1 100644 --- a/lib/libpthread/pthread_attr_get_np.3 +++ b/lib/libpthread/pthread_attr_get_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_attr_get_np.3,v 1.4.2.3 2003/03/03 22:02:43 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_attr_get_np.3,v 1.14 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_attr_get_np.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_ATTR_GET_NP 3 .Os .Sh NAME @@ -88,8 +88,9 @@ my_thread_stack_size(pthread_t pid) } .Ed .Sh ERRORS +The .Fn pthread_attr_get_np -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for one of given parameters. diff --git a/lib/libpthread/pthread_attr_setcreatesuspend_np.3 b/lib/libpthread/pthread_attr_setcreatesuspend_np.3 index 01c0a6c23c..5bce891ed6 100644 --- a/lib/libpthread/pthread_attr_setcreatesuspend_np.3 +++ b/lib/libpthread/pthread_attr_setcreatesuspend_np.3 @@ -22,15 +22,15 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_attr_setcreatesuspend_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_attr_setcreatesuspend_np.3,v 1.7 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_attr_setcreatesuspend_np.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_ATTR_SETCREATESUSPEND_NP 3 .Os .Sh NAME .Nm pthread_attr_setcreatesuspend_np -.Nd prepare attribute for creattion of suspended thread +.Nd prepare attribute for creation of suspended thread .Sh LIBRARY .Lb libpthread .Sh SYNOPSIS diff --git a/lib/libpthread/pthread_barrier_destroy.3 b/lib/libpthread/pthread_barrier_destroy.3 new file mode 100644 index 0000000000..a56d2a364b --- /dev/null +++ b/lib/libpthread/pthread_barrier_destroy.3 @@ -0,0 +1,140 @@ +.\" Copyright (c) 2004 Michael Telahun Makonnen +.\" 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: src/share/man/man3/pthread_barrier_destroy.3,v 1.6 2007/10/22 10:08:00 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_BARRIER 3 +.Os +.Sh NAME +.Nm pthread_barrier_destroy , pthread_barrier_init , pthread_barrier_wait +.Nd "destroy, initialize or wait on a barrier object" +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fn pthread_barrier_destroy "pthread_barrier_t *barrier" +.Ft int +.Fn pthread_barrier_init "pthread_barrier_t *barrier" "const pthread_barrierattr_t *attr" "unsigned count" +.Ft int +.Fn pthread_barrier_wait "pthread_barrier_t *barrier" +.Sh DESCRIPTION +The +.Fn pthread_barrier_init +function will initialize +.Fa barrier +with attributes specified in +.Fa attr , +or if it is +.Dv NULL , +with default attributes. +The number of threads that must call +.Fn pthread_barrier_wait +before any of the waiting threads can be +released is specified by +.Fa count . +The +.Fn pthread_barrier_destroy +function will destroy +.Fa barrier +and release any resources that may have been allocated on its behalf. +.Pp +The +.Fn pthread_barrier_wait +function will synchronize calling threads at +.Fa barrier . +The threads will be blocked from +making further progress until +a sufficient number of threads calls this function. +The number of threads that must call it before +any of them will be released is determined by the +.Fa count +argument to +.Fn pthread_barrier_init . +Once the threads have been released the barrier will be reset. +.Sh IMPLEMENTATION NOTES +The +.Dv PTHREAD_BARRIER_SERIAL_THREAD +return value will +always be returned by the last thread to reach the barrier. +.Sh RETURN VALUES +If successful, +both +.Fn pthread_barrier_destroy +and +.Fn pthread_barrier_init +will return zero. +Otherwise, an error number will be returned to indicate the error. +If the call to +.Fn pthread_barrier_wait +is successful, all but one of the threads will return zero. +That one thread will return +.Dv PTHREAD_BARRIER_SERIAL_THREAD . +Otherwise, an error number will be returned to indicate the error. +.Pp +None of these functions will return +.Er EINTR . +.Sh ERRORS +The +.Fn pthread_barrier_destroy +function will fail if: +.Bl -tag -width Er +.It Bq Er EBUSY +An attempt was made to destroy +.Fa barrier +while it was in use. +.El +.Pp +The +.Fn pthread_barrier_destroy +and +.Fn pthread_barrier_wait +functions may fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The value specified by +.Fa barrier +is invalid. +.El +.Pp +The +.Fn pthread_barrier_init +function will fail if: +.Bl -tag -width Er +.It Bq Er EAGAIN +The system lacks resources, +other than memory, +to initialize +.Fa barrier . +.It Bq Er EINVAL +The +.Fa count +argument is less than 1. +.It Bq Er ENOMEM +Insufficient memory to initialize +.Fa barrier . +.El +.Sh SEE ALSO +.Xr pthread_barrierattr 3 diff --git a/lib/libpthread/pthread_barrierattr.3 b/lib/libpthread/pthread_barrierattr.3 new file mode 100644 index 0000000000..f038cf6b02 --- /dev/null +++ b/lib/libpthread/pthread_barrierattr.3 @@ -0,0 +1,135 @@ +.\" Copyright (c) 2004 Michael Telahun Makonnen +.\" 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: src/share/man/man3/pthread_barrierattr.3,v 1.3 2007/10/22 10:08:00 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_BARRIERATTR 3 +.Os +.Sh NAME +.Nm pthread_barrierattr_destroy , pthread_barrierattr_getpshared , +.Nm pthread_barrierattr_init , pthread_barrierattr_setpshared +.Nd "manipulate a barrier attribute object" +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr" +.Ft int +.Fn pthread_barrierattr_getpshared "const pthread_barrierattr_t *attr" "int *pshared" +.Ft int +.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr" +.Ft int +.Fn pthread_barrierattr_setpshared "pthread_barrierattr_t *attr" "int pshared" +.Sh DESCRIPTION +The +.Fn pthread_barrierattr_init +function will initialize +.Fa attr +with default attributes. +The +.Fn pthread_barrierattr_destroy +function will destroy +.Fa attr +and release any resources that may have been allocated on its behalf. +.Pp +The +.Fn pthread_barrierattr_getpshared +function will put the value of the process-shared attribute from +.Fa attr +into the memory area pointed to by +.Fa pshared . +The +.Fn pthread_barrierattr_setpshared +function will set the process-shared attribute of +.Fa attr +to the value specified in +.Fa pshared . +The argument +.Fa pshared +may have one of the following values: +.Bl -tag -width ".Dv PTHREAD_PROCESS_PRIVATE" +.It Dv PTHREAD_PROCESS_PRIVATE +The barrier object it is attached to may only be accessed by +threads in the same process as the one that created the object. +.It Dv PTHREAD_PROCESS_SHARED +The barrier object it is attached to may be accessed by +threads in processes other than the one that created the object. +.El +.Sh RETURN VALUES +If successful, all these functions will return zero. +Otherwise, an error number will be returned to indicate the error. +.Pp +None of these functions will return +.Er EINTR . +.Sh ERRORS +The +.Fn pthread_barrierattr_destroy , +.Fn pthread_barrierattr_getpshared +and +.Fn pthread_barrierattr_setpshared +functions may fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The value specified by +.Fa attr +is invalid. +.El +.Pp +The +.Fn pthread_barrierattr_init +function will fail if: +.Bl -tag -width Er +.It Bq Er ENOMEM +Insufficient memory to initialize the barrier attribute object +.Fa attr . +.El +.Pp +The +.Fn pthread_barrierattr_setpshared +function will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The value specified in +.Fa pshared +is not one of the allowed values. +.El +.Sh SEE ALSO +.Xr pthread_barrier_destroy 3 , +.Xr pthread_barrier_init 3 , +.Xr pthread_barrier_wait 3 +.Sh HISTORY +.Sh BUGS +The implementation of +barriers +does not fully conform to +.St -p1003.2 +because the process-shared attribute is ignored; +if any value other than +.Dv PTHREAD_PROCESS_PRIVATE +is specified in a call to +.Fn pthread_barrierattr_setpshared , +it will return +.Er EINVAL . diff --git a/lib/libpthread/pthread_cancel.3 b/lib/libpthread/pthread_cancel.3 index 93aecba8a2..7bed5502c3 100644 --- a/lib/libpthread/pthread_cancel.3 +++ b/lib/libpthread/pthread_cancel.3 @@ -1,6 +1,6 @@ -.\" $FreeBSD: src/lib/libc_r/man/pthread_cancel.3,v 1.3.2.4 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cancel.3,v 1.13 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cancel.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_CANCEL 3 .Os .Sh NAME @@ -46,14 +46,15 @@ expands to a constant expression of type whose value matches no pointer to an object in memory nor the value .Dv NULL . .Sh RETURN VALUES -If successful, the +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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ESRCH No thread could be found corresponding to that specified by the given @@ -68,11 +69,12 @@ thread ID. .Xr pthread_setcanceltype 3 , .Xr pthread_testcancel 3 .Sh STANDARDS +The .Fn pthread_cancel -conforms to +function conforms to .St -p1003.1-96 . .Sh AUTHORS -This man page was written by +This manual page was written by .An David Leonard Aq d@openbsd.org for the .Ox diff --git a/lib/libpthread/pthread_cleanup_pop.3 b/lib/libpthread/pthread_cleanup_pop.3 index 5480ee0b56..3fdc81522a 100644 --- a/lib/libpthread/pthread_cleanup_pop.3 +++ b/lib/libpthread/pthread_cleanup_pop.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cleanup_pop.3,v 1.5.2.4 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cleanup_pop.3,v 1.14 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cleanup_pop.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_CLEANUP_POP 3 .Os .Sh NAME @@ -52,14 +52,16 @@ then .Fn pthread_cleanup_pop does nothing. .Sh RETURN VALUES +The .Fn pthread_cleanup_pop -does not return any value. +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 -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cleanup_push.3 b/lib/libpthread/pthread_cleanup_push.3 index 83f673581a..ba3cdcd10c 100644 --- a/lib/libpthread/pthread_cleanup_push.3 +++ b/lib/libpthread/pthread_cleanup_push.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cleanup_push.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cleanup_push.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cleanup_push.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_CLEANUP_PUSH 3 .Os .Sh NAME @@ -54,14 +54,16 @@ is called, it is passed .Fa arg as its only argument. .Sh RETURN VALUES +The .Fn pthread_cleanup_push -does not return any value. +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 -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_broadcast.3 b/lib/libpthread/pthread_cond_broadcast.3 index 8b16161532..583e143aa5 100644 --- a/lib/libpthread/pthread_cond_broadcast.3 +++ b/lib/libpthread/pthread_cond_broadcast.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_broadcast.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_broadcast.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_broadcast.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_BROADCAST 3 .Os .Sh NAME @@ -51,8 +51,9 @@ If successful, the function will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_cond_broadcast -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -66,6 +67,7 @@ is invalid. .Xr pthread_cond_timedwait 3 , .Xr pthread_cond_wait 3 .Sh STANDARDS +The .Fn pthread_cond_broadcast -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_destroy.3 b/lib/libpthread/pthread_cond_destroy.3 index 1fbaa43a0f..51b2d3e733 100644 --- a/lib/libpthread/pthread_cond_destroy.3 +++ b/lib/libpthread/pthread_cond_destroy.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_destroy.3,v 1.6.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_destroy.3,v 1.16 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_destroy.3,v 1.2 2003/06/17 04:26:47 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_DESTROY 3 .Os .Sh NAME @@ -51,8 +51,9 @@ If successful, the function will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_cond_destroy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -70,6 +71,7 @@ is locked by another thread. .Xr pthread_cond_timedwait 3 , .Xr pthread_cond_wait 3 .Sh STANDARDS +The .Fn pthread_cond_destroy -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_init.3 b/lib/libpthread/pthread_cond_init.3 index 5b130bcf9a..4cc21b64c3 100644 --- a/lib/libpthread/pthread_cond_init.3 +++ b/lib/libpthread/pthread_cond_init.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_init.3,v 1.6.2.6 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_init.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_init.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_INIT 3 .Os .Sh NAME @@ -55,8 +55,9 @@ 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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -70,12 +71,14 @@ The system temporarily lacks the resources to create another condition variable. .El .Sh SEE ALSO +.Xr pthread_condattr 3 , .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 -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_signal.3 b/lib/libpthread/pthread_cond_signal.3 index ac401fbfef..a36b7ea3bd 100644 --- a/lib/libpthread/pthread_cond_signal.3 +++ b/lib/libpthread/pthread_cond_signal.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_signal.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_signal.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_signal.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_SIGNAL 3 .Os .Sh NAME @@ -51,8 +51,9 @@ If successful, the function will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_cond_signal -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -66,6 +67,7 @@ is invalid. .Xr pthread_cond_timedwait 3 , .Xr pthread_cond_wait 3 .Sh STANDARDS +The .Fn pthread_cond_signal -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_timedwait.3 b/lib/libpthread/pthread_cond_timedwait.3 index 321fbb57c1..0fa2437695 100644 --- a/lib/libpthread/pthread_cond_timedwait.3 +++ b/lib/libpthread/pthread_cond_timedwait.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_timedwait.3,v 1.8.2.7 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_timedwait.3,v 1.21 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_timedwait.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_TIMEDWAIT 3 .Os .Sh NAME @@ -46,7 +46,7 @@ The function atomically blocks the current thread waiting on the condition variable specified by .Fa cond , -and unblocks the mutex specified by +and releases the mutex specified by .Fa mutex . The waiting thread unblocks only after another thread calls .Xr pthread_cond_signal 3 , @@ -64,8 +64,9 @@ function will return zero. Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_cond_timedwait -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -77,6 +78,10 @@ is invalid. .It Bq Er ETIMEDOUT The system time has reached or exceeded the time specified in .Fa abstime . +.\".It Bq Er EPERM +.\"The specified +.\".Fa mutex +.\"was not locked by the calling thread. .El .Sh SEE ALSO .Xr pthread_cond_broadcast 3 , @@ -85,6 +90,7 @@ The system time has reached or exceeded the time specified in .Xr pthread_cond_signal 3 , .Xr pthread_cond_wait 3 .Sh STANDARDS +The .Fn pthread_cond_timedwait -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_cond_wait.3 b/lib/libpthread/pthread_cond_wait.3 index a356e375c7..0ccae5611b 100644 --- a/lib/libpthread/pthread_cond_wait.3 +++ b/lib/libpthread/pthread_cond_wait.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_cond_wait.3,v 1.8.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_cond_wait.3,v 1.22 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_cond_wait.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_COND_WAIT 3 .Os .Sh NAME @@ -46,7 +46,7 @@ The function atomically blocks the current thread waiting on the condition variable specified by .Fa cond , -and unblocks the mutex specified by +and releases the mutex specified by .Fa mutex . The waiting thread unblocks only after another thread calls .Xr pthread_cond_signal 3 , @@ -62,8 +62,9 @@ function will return zero. Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_cond_wait -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -71,6 +72,10 @@ The value specified by or the value specified by .Fa mutex is invalid. +.\".It Bq Er EPERM +.\"The specified +.\".Fa mutex +.\"was not locked by the calling thread. .El .Sh SEE ALSO .Xr pthread_cond_broadcast 3 , @@ -79,6 +84,7 @@ is invalid. .Xr pthread_cond_signal 3 , .Xr pthread_cond_timedwait 3 .Sh STANDARDS +The .Fn pthread_cond_wait -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_condattr.3 b/lib/libpthread/pthread_condattr.3 index 872c6f566b..816f737814 100644 --- a/lib/libpthread/pthread_condattr.3 +++ b/lib/libpthread/pthread_condattr.3 @@ -25,9 +25,9 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_condattr.3,v 1.2.2.8 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_condattr.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_condattr.3,v 1.3 2004/03/11 12:28:51 hmp Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_CONDATTR 3 .Os .Sh NAME @@ -47,7 +47,7 @@ Condition attribute objects are used to specify parameters to .Fn pthread_cond_init . .Dx Ns 's implementation of conditions does not support any non-default -attributes, so these functions are not very useful, though they are required to +attributes, so these functions are not very useful, though they are required to be present by .Tn POSIX . .Pp @@ -62,15 +62,17 @@ function destroys a condition attribute object. If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. .Sh ERRORS +The .Fn pthread_condattr_init -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Out of memory. .El .Pp +The .Fn pthread_condattr_destroy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -79,8 +81,9 @@ Invalid value for .Sh SEE ALSO .Xr pthread_cond_init 3 .Sh STANDARDS +The .Fn pthread_condattr_init and .Fn pthread_condattr_destroy -conform to -.St -p1003.1-96 +functions conform to +.St -p1003.1-96 . diff --git a/lib/libpthread/pthread_create.3 b/lib/libpthread/pthread_create.3 index 78532893dd..122a7f4c5f 100644 --- a/lib/libpthread/pthread_create.3 +++ b/lib/libpthread/pthread_create.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_create.3,v 1.9.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_create.3,v 1.24 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_create.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_CREATE 3 .Os .Sh NAME @@ -94,19 +94,23 @@ The signal mask is inherited from the creating thread. The set of signals pending for the new thread is empty. .El .Sh RETURN VALUES -If successful, the +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 -will fail if: +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 EPERM +.\"The caller does not have appropriate permission to set the required scheduling +.\"parameters or scheduling policy. .It Bq Er EINVAL The value specified by .Fa attr @@ -114,11 +118,13 @@ is invalid. .El .Sh SEE ALSO .Xr fork 2 , +.Xr pthread_attr 3 , .Xr pthread_cleanup_pop 3 , .Xr pthread_cleanup_push 3 , .Xr pthread_exit 3 , .Xr pthread_join 3 .Sh STANDARDS +The .Fn pthread_create -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_detach.3 b/lib/libpthread/pthread_detach.3 index 32879eb88a..b022a0632b 100644 --- a/lib/libpthread/pthread_detach.3 +++ b/lib/libpthread/pthread_detach.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_detach.3,v 1.6.2.6 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_detach.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_detach.3,v 1.3 2007/06/30 19:03:52 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_DETACH 3 .Os .Sh NAME @@ -59,7 +59,7 @@ The effect of multiple .Fn pthread_detach calls on the same target thread is unspecified. .Sh RETURN VALUES -If successful, the +If successful, the .Fn pthread_detach function will return zero. Otherwise an error number will be returned to @@ -68,11 +68,14 @@ Note that the function does not change the value of .Va errno as it did for some drafts of the standard. -These early drafts also passed a pointer to pthread_t as the argument. +These early drafts also passed a pointer to +.Vt pthread_t +as the argument. Beware! .Sh ERRORS +The .Fn pthread_detach -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The implementation has detected that the value specified by @@ -86,6 +89,7 @@ thread ID, .Sh SEE ALSO .Xr pthread_join 3 .Sh STANDARDS +The .Fn pthread_detach -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_equal.3 b/lib/libpthread/pthread_equal.3 index 8c06b01020..65c26c84c4 100644 --- a/lib/libpthread/pthread_equal.3 +++ b/lib/libpthread/pthread_equal.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_equal.3,v 1.4.2.6 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_equal.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_equal.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_EQUAL 3 .Os .Sh NAME @@ -64,6 +64,7 @@ None. .Xr pthread_create 3 , .Xr pthread_exit 3 .Sh STANDARDS +The .Fn pthread_equal -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_exit.3 b/lib/libpthread/pthread_exit.3 index 8029b088d8..adb81ea846 100644 --- a/lib/libpthread/pthread_exit.3 +++ b/lib/libpthread/pthread_exit.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_exit.3,v 1.8.2.7 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_exit.3,v 1.21 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_exit.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_EXIT 3 .Os .Sh NAME @@ -67,7 +67,8 @@ An implicit call to 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. +it. +The function's return value serves as the thread's exit status. .Pp The behavior of .Fn pthread_exit @@ -100,6 +101,7 @@ None. .Xr pthread_create 3 , .Xr pthread_join 3 .Sh STANDARDS +The .Fn pthread_exit -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_getconcurrency.3 b/lib/libpthread/pthread_getconcurrency.3 index 599715a543..0d7984eaf9 100644 --- a/lib/libpthread/pthread_getconcurrency.3 +++ b/lib/libpthread/pthread_getconcurrency.3 @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_getconcurrency.3,v 1.2.2.1 2003/05/27 18:18:01 jdp Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_getconcurrency.3,v 1.6 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_getconcurrency.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_GETCONCURRENCY 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_getspecific.3 b/lib/libpthread/pthread_getspecific.3 index e9bb03dbba..7887772c3d 100644 --- a/lib/libpthread/pthread_getspecific.3 +++ b/lib/libpthread/pthread_getspecific.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_getspecific.3,v 1.6.2.4 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_getspecific.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_getspecific.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_GETSPECIFIC 3 .Os .Sh NAME @@ -62,8 +62,9 @@ has been deleted with .Fn pthread_key_delete is undefined. .Pp +The .Fn pthread_getspecific -may be called from a thread-specific data destructor function. +function may be called from a thread-specific data destructor function. .Sh RETURN VALUES The .Fn pthread_getspecific @@ -79,6 +80,7 @@ None. .Xr pthread_key_delete 3 , .Xr pthread_setspecific 3 .Sh STANDARDS +The .Fn pthread_getspecific -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_join.3 b/lib/libpthread/pthread_join.3 index 86a02d4398..77f33638aa 100644 --- a/lib/libpthread/pthread_join.3 +++ b/lib/libpthread/pthread_join.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_join.3,v 1.7.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_join.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_join.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_JOIN 3 .Os .Sh NAME @@ -74,14 +74,15 @@ is cancelled, then the target thread is not detached. A thread that has exited but remains unjoined counts against [_POSIX_THREAD_THREADS_MAX]. .Sh RETURN VALUES -If successful, the +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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The implementation has detected that the value specified by @@ -100,6 +101,7 @@ specifies the calling thread. .Xr wait 2 , .Xr pthread_create 3 .Sh STANDARDS +The .Fn pthread_join -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_key_create.3 b/lib/libpthread/pthread_key_create.3 index 35b0a222bf..fc77382e93 100644 --- a/lib/libpthread/pthread_key_create.3 +++ b/lib/libpthread/pthread_key_create.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_key_create.3,v 1.6.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_key_create.3,v 1.16 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_key_create.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_KEY_CREATE 3 .Os .Sh NAME @@ -88,8 +88,9 @@ and returns zero. Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_key_create -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EAGAIN The system lacked the necessary resources to create another thread-specific @@ -103,6 +104,7 @@ Insufficient memory exists to create the key. .Xr pthread_key_delete 3 , .Xr pthread_setspecific 3 .Sh STANDARDS +The .Fn pthread_key_create -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_key_delete.3 b/lib/libpthread/pthread_key_delete.3 index c27b16042a..f1322666e3 100644 --- a/lib/libpthread/pthread_key_delete.3 +++ b/lib/libpthread/pthread_key_delete.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_key_delete.3,v 1.6.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_key_delete.3,v 1.16 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_key_delete.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_KEY_DELETE 3 .Os .Sh NAME @@ -81,8 +81,9 @@ function will return zero. Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_key_delete -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The @@ -94,6 +95,7 @@ value is invalid. .Xr pthread_key_create 3 , .Xr pthread_setspecific 3 .Sh STANDARDS +The .Fn pthread_key_delete -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_kill.3 b/lib/libpthread/pthread_kill.3 index c198e70c1a..44cc891382 100644 --- a/lib/libpthread/pthread_kill.3 +++ b/lib/libpthread/pthread_kill.3 @@ -25,9 +25,9 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_kill.3,v 1.3.2.6 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_kill.3,v 1.13 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_kill.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_KILL 3 .Os .Sh NAME @@ -56,8 +56,9 @@ If successful, returns 0. Otherwise, an error number is returned. .Sh ERRORS +The .Fn pthread_kill -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ESRCH .Fa thread @@ -71,6 +72,7 @@ is an invalid or unsupported signal number. .Xr pthread_self 3 , .Xr raise 3 .Sh STANDARDS +The .Fn pthread_kill -conforms to -.St -p1003.1-96 +function conforms to +.St -p1003.1-96 . diff --git a/lib/libpthread/pthread_main_np.3 b/lib/libpthread/pthread_main_np.3 index 6db8543f7b..5ae597c7d3 100644 --- a/lib/libpthread/pthread_main_np.3 +++ b/lib/libpthread/pthread_main_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_main_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_main_np.3,v 1.6 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_main_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MAIN_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_multi_np.3 b/lib/libpthread/pthread_multi_np.3 index 3f9dc32d81..7afce1b2e5 100644 --- a/lib/libpthread/pthread_multi_np.3 +++ b/lib/libpthread/pthread_multi_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_multi_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_multi_np.3,v 1.7 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_multi_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MULTI_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_mutex_destroy.3 b/lib/libpthread/pthread_mutex_destroy.3 index acc8984c13..6629049b44 100644 --- a/lib/libpthread/pthread_mutex_destroy.3 +++ b/lib/libpthread/pthread_mutex_destroy.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_destroy.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_destroy.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutex_destroy.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEX_DESTROY 3 .Os .Sh NAME @@ -51,8 +51,9 @@ If successful, will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_mutex_destroy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -68,6 +69,7 @@ is locked by another thread. .Xr pthread_mutex_trylock 3 , .Xr pthread_mutex_unlock 3 .Sh STANDARDS +The .Fn pthread_mutex_destroy -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutex_init.3 b/lib/libpthread/pthread_mutex_init.3 index 7e54ea9fdc..c95d8b50d0 100644 --- a/lib/libpthread/pthread_mutex_init.3 +++ b/lib/libpthread/pthread_mutex_init.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_init.3,v 1.6.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_init.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutex_init.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEX_INIT 3 .Os .Sh NAME @@ -55,8 +55,9 @@ 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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -64,15 +65,15 @@ The value specified by is invalid. .It Bq Er ENOMEM The process cannot allocate enough memory to create another mutex. -.It Bq Er EAGAIN -The temporarily lacks the resources to create another mutex. .El .Sh SEE ALSO +.Xr pthread_mutexattr 3 , .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 -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutex_lock.3 b/lib/libpthread/pthread_mutex_lock.3 index 1da0200b96..0ac2853138 100644 --- a/lib/libpthread/pthread_mutex_lock.3 +++ b/lib/libpthread/pthread_mutex_lock.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_lock.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_lock.3,v 1.18 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutex_lock.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEX_LOCK 3 .Os .Sh NAME @@ -53,8 +53,9 @@ If successful, will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_mutex_lock -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -70,6 +71,7 @@ A deadlock would occur if the thread blocked waiting for .Xr pthread_mutex_trylock 3 , .Xr pthread_mutex_unlock 3 .Sh STANDARDS +The .Fn pthread_mutex_lock -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutex_lock.3 b/lib/libpthread/pthread_mutex_timedlock.3 similarity index 50% copy from lib/libpthread/pthread_mutex_lock.3 copy to lib/libpthread/pthread_mutex_timedlock.3 index 1da0200b96..4503486517 100644 --- a/lib/libpthread/pthread_mutex_lock.3 +++ b/lib/libpthread/pthread_mutex_timedlock.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1997 Brian Cully +.\" Copyright (c) 2003 Michael Telahun Makonnen .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -9,14 +9,11 @@ .\" 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 +.\" 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 REGENTS OR CONTRIBUTORS BE LIABLE +.\" 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) @@ -25,51 +22,82 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_lock.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ -.\" $DragonFly: src/lib/libc_r/man/pthread_mutex_lock.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_timedlock.3,v 1.6 2007/10/22 10:08:00 ru Exp $ .\" -.Dd April 15, 2009 -.Dt PTHREAD_MUTEX_LOCK 3 +.Dd July 10, 2009 +.Dt PTHREAD_MUTEX_TIMEDLOCK 3 .Os .Sh NAME -.Nm pthread_mutex_lock -.Nd lock a mutex +.Nm pthread_mutex_timedlock +.Nd lock a mutex without blocking indefinitely .Sh LIBRARY .Lb libpthread .Sh SYNOPSIS .In pthread.h +.In time.h .Ft int -.Fn pthread_mutex_lock "pthread_mutex_t *mutex" +.Fn pthread_mutex_timedlock "pthread_mutex_t *mutex" "const struct timespec *abs_timeout" .Sh DESCRIPTION The -.Fn pthread_mutex_lock -function locks +.Fn pthread_mutex_timedlock +function will lock .Fa mutex . -If the mutex is already locked, the calling thread will block until the -mutex becomes available. +If it is already locked the calling thread will block until +the mutex becomes available or +the timeout, +specified by abs_timeout, +expires. +The time of the timeout is an absolute time and +is not relative to the current time. .Sh RETURN VALUES If successful, -.Fn pthread_mutex_lock +.Fn pthread_mutex_timedlock will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS -.Fn pthread_mutex_lock -will fail if: +The +.Fn pthread_mutex_timedlock +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL -The value specified by +The +.Fa mutex +was created with the protocol attribute having the +value PTHREAD_PRIO_PROTECT and +the calling thread's priority is higher than the +mutex's current priority ceiling. +.It Bq Er EINVAL +The process or thread would have blocked, and +.Fa abs_timeout +specified a nanosecond value less than zero or +greater than or equal to 1 billion. +.It Bq Er EINVAL +The .Fa mutex -is invalid. +parameter is invalid. +.It Bq Er ETIMEDOUT +The +.Fa mutex +could not be locked before the timeout expired. +.It Bq Er EAGAIN +The +.Fa mutex +could not be acquired because the +maximum number of recursive locks for the +.Fa mutex +has been exceeded. .It Bq Er EDEADLK -A deadlock would occur if the thread blocked waiting for +The current thread already owns the .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 , .Xr pthread_mutex_unlock 3 .Sh STANDARDS -.Fn pthread_mutex_lock -conforms to +The +.Fn pthread_mutex_timedlock +function is expected to conform to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutex_trylock.3 b/lib/libpthread/pthread_mutex_trylock.3 index a088f4116b..83548d9f1f 100644 --- a/lib/libpthread/pthread_mutex_trylock.3 +++ b/lib/libpthread/pthread_mutex_trylock.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_trylock.3,v 1.5.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_trylock.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutex_trylock.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEX_TRYLOCK 3 .Os .Sh NAME @@ -54,8 +54,9 @@ If successful, will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_mutex_trylock -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -71,6 +72,7 @@ is already locked. .Xr pthread_mutex_lock 3 , .Xr pthread_mutex_unlock 3 .Sh STANDARDS +The .Fn pthread_mutex_trylock -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutex_unlock.3 b/lib/libpthread/pthread_mutex_unlock.3 index ca2c868f7e..7965f1d0b9 100644 --- a/lib/libpthread/pthread_mutex_unlock.3 +++ b/lib/libpthread/pthread_mutex_unlock.3 @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutex_unlock.3,v 1.5.2.6 2002/07/15 07:59:53 maxim Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutex_unlock.3,v 1.16 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutex_unlock.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEX_UNLOCK 3 .Os .Sh NAME @@ -53,8 +53,9 @@ If successful, will return zero, otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_mutex_unlock -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -70,6 +71,7 @@ The current thread does not hold a lock on .Xr pthread_mutex_lock 3 , .Xr pthread_mutex_trylock 3 .Sh STANDARDS +The .Fn pthread_mutex_unlock -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_mutexattr.3 b/lib/libpthread/pthread_mutexattr.3 index 08a1cfcaae..e05832484a 100644 --- a/lib/libpthread/pthread_mutexattr.3 +++ b/lib/libpthread/pthread_mutexattr.3 @@ -25,9 +25,9 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutexattr.3,v 1.2.2.7 2002/12/29 16:35:35 schweikh Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutexattr.3,v 1.13 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutexattr.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEXATTR 3 .Os .Sh NAME @@ -90,23 +90,26 @@ to the location pointed to by the second function parameter. If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. .Sh ERRORS +The .Fn pthread_mutexattr_init -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Out of memory. .El .Pp +The .Fn pthread_mutexattr_destroy -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for .Fa attr . .El .Pp +The .Fn pthread_mutexattr_setprioceiling -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -115,16 +118,18 @@ or invalid value for .Fa prioceiling . .El .Pp +The .Fn pthread_mutexattr_getprioceiling -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for .Fa attr . .El .Pp +The .Fn pthread_mutexattr_setprotocol -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -133,16 +138,18 @@ or invalid value for .Fa protocol . .El .Pp +The .Fn pthread_mutexattr_getprotocol -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for .Fa attr . .El .Pp +The .Fn pthread_mutexattr_settype -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -151,8 +158,9 @@ or invalid value for .Fa type . .El .Pp +The .Fn pthread_mutexattr_gettype -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for @@ -161,12 +169,14 @@ Invalid value for .Sh SEE ALSO .Xr pthread_mutex_init 3 .Sh STANDARDS +The .Fn pthread_mutexattr_init and .Fn pthread_mutexattr_destroy -conform to -.St -p1003.1-96 +functions conform to +.St -p1003.1-96 . .Pp +The .Fn pthread_mutexattr_setprioceiling , .Fn pthread_mutexattr_getprioceiling , .Fn pthread_mutexattr_setprotocol , @@ -174,5 +184,5 @@ conform to .Fn pthread_mutexattr_settype , and .Fn pthread_mutexattr_gettype -conform to -.St -susv2 +functions conform to +.St -susv2 . diff --git a/lib/libpthread/pthread_mutexattr_getkind_np.3 b/lib/libpthread/pthread_mutexattr_getkind_np.3 index fd3b7a850c..6081fbba01 100644 --- a/lib/libpthread/pthread_mutexattr_getkind_np.3 +++ b/lib/libpthread/pthread_mutexattr_getkind_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_mutexattr_getkind_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_mutexattr_getkind_np.3,v 1.7 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_mutexattr_getkind_np.3,v 1.3 2006/04/08 20:55:59 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_MUTEXATTR_GETKIND_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_once.3 b/lib/libpthread/pthread_once.3 index 6a643babe1..7a13a4b3e8 100644 --- a/lib/libpthread/pthread_once.3 +++ b/lib/libpthread/pthread_once.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_once.3,v 1.6.2.7 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_once.3,v 1.21 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_once.3,v 1.4 2008/02/09 09:32:05 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_ONCE 3 .Os .Sh NAME @@ -94,7 +94,7 @@ is undefined if has automatic storage duration or is not initialized by .Fa PTHREAD_ONCE_INIT . .Sh RETURN VALUES -If successful, the +If successful, the .Fn pthread_once function will return zero. Otherwise an error number will be returned to @@ -102,6 +102,7 @@ indicate the error. .Sh ERRORS None. .Sh STANDARDS +The .Fn pthread_once -conforms to +functions conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_resume_all_np.3 b/lib/libpthread/pthread_resume_all_np.3 index 33d670ac44..a105cf42e9 100644 --- a/lib/libpthread/pthread_resume_all_np.3 +++ b/lib/libpthread/pthread_resume_all_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_resume_all_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_resume_all_np.3,v 1.6 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_resume_all_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RESUME_ALL_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_resume_np.3 b/lib/libpthread/pthread_resume_np.3 index 082930d99d..dcf076ff80 100644 --- a/lib/libpthread/pthread_resume_np.3 +++ b/lib/libpthread/pthread_resume_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_resume_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_resume_np.3,v 1.6 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_resume_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RESUME_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_rwlock_destroy.3 b/lib/libpthread/pthread_rwlock_destroy.3 index cf01381e0d..ac98e19bac 100644 --- a/lib/libpthread/pthread_rwlock_destroy.3 +++ b/lib/libpthread/pthread_rwlock_destroy.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_destroy.3,v 1.3.2.3 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlock_destroy.3,v 1.12 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_destroy.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCK_DESTROY 3 .Os .Sh NAME @@ -45,7 +45,8 @@ function is used to destroy a read/write lock previously created with .Sh RETURN VALUES If successful, the .Fn pthread_rwlock_destroy -function will return zero. Otherwise an error number will be returned +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS The diff --git a/lib/libpthread/pthread_rwlock_init.3 b/lib/libpthread/pthread_rwlock_init.3 index e467031286..19241cf751 100644 --- a/lib/libpthread/pthread_rwlock_init.3 +++ b/lib/libpthread/pthread_rwlock_init.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_init.3,v 1.2.2.3 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlock_init.3,v 1.11 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_init.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCK_INIT 3 .Os .Sh NAME @@ -53,7 +53,8 @@ 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 +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS The diff --git a/lib/libpthread/pthread_rwlock_rdlock.3 b/lib/libpthread/pthread_rwlock_rdlock.3 index ff2aa6a95a..7ed643e21a 100644 --- a/lib/libpthread/pthread_rwlock_rdlock.3 +++ b/lib/libpthread/pthread_rwlock_rdlock.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_rdlock.3,v 1.2.2.2 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlock_rdlock.3,v 1.10 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_rdlock.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCK_RDLOCK 3 .Os .Sh NAME @@ -48,17 +48,19 @@ function acquires a read lock on 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 +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 +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, +A thread may hold multiple concurrent read locks. +If so, .Fn pthread_rwlock_unlock must be called once for each lock obtained. .Pp @@ -71,7 +73,8 @@ If successful, the .Fn pthread_rwlock_rdlock and .Fn pthread_rwlock_tryrdlock -functions will return zero. Otherwise an error number will be returned +functions will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS The diff --git a/lib/libpthread/pthread_rwlock_timedrdlock.3 b/lib/libpthread/pthread_rwlock_timedrdlock.3 new file mode 100644 index 0000000000..6f67e88798 --- /dev/null +++ b/lib/libpthread/pthread_rwlock_timedrdlock.3 @@ -0,0 +1,118 @@ +.\" Copyright (c) 2004 Michael Telahun Makonnen +.\" 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: src/share/man/man3/pthread_rwlock_timedrdlock.3,v 1.3 2007/10/22 10:08:00 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_RWLOCK_TIMEDRDLOCK 3 +.Os +.Sh NAME +.Nm pthread_rwlock_timedrdlock +.Nd "acquire a read-write lock for reading or give up after a specified period" +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fn pthread_rwlock_timedrdlock "pthread_rwlock_t *rwlock" "const struct timespec *abs_timeout" +.Sh DESCRIPTION +This function acquires a read lock on the read-write lock +.Fa rwlock . +However, if the lock cannot be +acquired without waiting for another thread to +unlock the lock, +this wait shall be terminated when +.Fa abs_timeout +expires. +.Pp +A thread may hold multiple concurrent read locks. +The +.Xr pthread_rwlock_unlock 3 +function must be called once for each lock acquired. +.Pp +If the thread should be interrupted by a signal, +the +.Fn pthread_rwlock_timedrdlock +function will be automatically restarted after the thread returns from +the signal handler. +.Pp +The calling thread may deadlock if +at the time the call is made it holds a write lock on +.Fa rwlock . +The results are undefined if this function is called with +an uninitialized read-write lock. +.Sh IMPLEMENTATION NOTES +To prevent writer starvation, writers are favored over readers. +.Sh RETURN VALUES +If successful, the +.Fn pthread_rwlock_timedrdlock +function will return zero. +Otherwise, an error number will be returned to indicate the error. +.Pp +This function shall not return an error code of +.Er EINTR . +.Sh ERRORS +The +.Fn pthread_rwlock_timedrdlock +function will fail if: +.Bl -tag -width Er +.It Bq Er ETIMEDOUT +The lock could not be acquired before the specified timeout expired. +.El +.Pp +The +.Fn pthread_rwlock_timedrdlock +function may fail if: +.Bl -tag -width Er +.It Bq Er EAGAIN +The read lock could not be +acquired because the maximum number of read locks for +.Fa rwlock +would be exceeded. +.It Bq Er EDEADLK +The calling thread already holds a write lock on +.Fa rwlock . +.It Bq Er EINVAL +The value specified by +.Fa rwlock +does not refer to an initialized read-write lock object, +or the +.Fa abs_timeout +nanosecond value is less than zero or +greater than or equal to 1 billion. +.El +.Sh SEE ALSO +.Xr pthread_rwlock_init 3 , +.Xr pthread_rwlock_timedwrlock 3 , +.Xr pthread_rwlock_unlock 3 +.Sh STANDARDS +The +.Fn pthread_rwlock_timedrdlock +function is expected to conform to +.St -p1003.1-96 . +.Sh HISTORY +The +.Fn pthread_rwlock_timedrdlock +function first appeared in +.Fx 5.2 . diff --git a/lib/libpthread/pthread_rwlock_timedwrlock.3 b/lib/libpthread/pthread_rwlock_timedwrlock.3 new file mode 100644 index 0000000000..9c188872e5 --- /dev/null +++ b/lib/libpthread/pthread_rwlock_timedwrlock.3 @@ -0,0 +1,108 @@ +.\" Copyright (c) 2004 Michael Telahun Makonnen +.\" 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: src/share/man/man3/pthread_rwlock_timedwrlock.3,v 1.3 2007/10/22 10:08:00 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_RWLOCK_TIMEDWRLOCK 3 +.Os +.Sh NAME +.Nm pthread_rwlock_timedwrlock +.Nd "acquire a read-write lock for writing or give up after a specified period" +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fn pthread_rwlock_timedwrlock "pthread_rwlock_t *rwlock" "const struct timespec *abs_timeout" +.Sh DESCRIPTION +This function acquires a write lock on the read-write lock +.Fa rwlock . +However, if the lock cannot be +acquired without waiting for another thread to +unlock the lock, +this wait shall be terminated when +.Fa abs_timeout +expires. +.Pp +If the thread should be interrupted by a signal, +the +.Fn pthread_rwlock_timedwrlock +function will be automatically restarted after the thread returns from +the signal handler. +.Pp +The calling thread may deadlock if +at the time the call is made it holds +.Fa rwlock . +The results are undefined if this function is called with +an uninitialized read-write lock. +.Sh IMPLEMENTATION NOTES +To prevent writer starvation, writers are favored over readers. +.Sh RETURN VALUES +If successful, the +.Fn pthread_rwlock_timedwrlock +function will return zero. +Otherwise, an error number will be returned to indicate the error. +.Pp +This function shall not return an error code of +.Er EINTR . +.Sh ERRORS +The +.Fn pthread_rwlock_timedwrlock +function shall fail if: +.Bl -tag -width Er +.It Bq Er ETIMEDOUT +The lock could not be acquired before the specified timeout expired. +.El +.Pp +The +.Fn pthread_rwlock_timedrwlock +function may fail if: +.Bl -tag -width Er +.It Bq Er EDEADLK +The calling thread already holds +.Fa rwlock . +.It Bq Er EINVAL +The value specified by +.Fa rwlock +does not refer to an initialized read-write lock object, +or the +.Fa abs_timeout +nanosecond value is less than zero or +greater than or equal to 1 billion. +.El +.Sh SEE ALSO +.Xr pthread_rwlock_init 3 , +.Xr pthread_rwlock_timedrdlock 3 , +.Xr pthread_rwlock_unlock 3 +.Sh STANDARDS +The +.Fn pthread_rwlock_timedwrlock +function is expected to conform to +.St -p1003.1-96 . +.Sh HISTORY +The +.Fn pthread_rwlock_timedwrlock +function first appeared in +.Fx 5.2 . diff --git a/lib/libpthread/pthread_rwlock_unlock.3 b/lib/libpthread/pthread_rwlock_unlock.3 index 9706584c7c..0c570b6256 100644 --- a/lib/libpthread/pthread_rwlock_unlock.3 +++ b/lib/libpthread/pthread_rwlock_unlock.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_unlock.3,v 1.2.2.2 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlock_unlock.3,v 1.10 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_unlock.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCK_UNLOCK 3 .Os .Sh NAME @@ -49,7 +49,8 @@ or .Sh RETURN VALUES If successful, the .Fn pthread_rwlock_unlock -function will return zero. Otherwise an error number will be returned +function will return zero. +Otherwise an error number will be returned to indicate the error. .Pp The results are undefined if diff --git a/lib/libpthread/pthread_rwlock_wrlock.3 b/lib/libpthread/pthread_rwlock_wrlock.3 index 6d48ed964b..1496269275 100644 --- a/lib/libpthread/pthread_rwlock_wrlock.3 +++ b/lib/libpthread/pthread_rwlock_wrlock.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_wrlock.3,v 1.2.2.2 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlock_wrlock.3,v 1.11 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_wrlock.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCK_WRLOCK 3 .Os .Sh NAME @@ -59,7 +59,8 @@ If successful, the .Fn pthread_rwlock_wrlock and .Fn pthread_rwlock_trywrlock -functions will return zero. Otherwise an error number will be returned +functions will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS The @@ -88,9 +89,10 @@ Insufficient memory exists to initialize the lock (applies to statically initialized locks only). .El .Sh SEE ALSO -.Xr pthread_rwlock_trywrlock 3 , -.Xr pthread_rwlock_unlock 3 , -.Xr pthread_rwlock_wrlock 3 +.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 diff --git a/lib/libpthread/pthread_rwlockattr_destroy.3 b/lib/libpthread/pthread_rwlockattr_destroy.3 index a621df1d32..a15ee81f76 100644 --- a/lib/libpthread/pthread_rwlockattr_destroy.3 +++ b/lib/libpthread/pthread_rwlockattr_destroy.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlockattr_destroy.3,v 1.3.2.3 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlockattr_destroy.3,v 1.13 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlockattr_destroy.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCKATTR_DESTROY 3 .Os .Sh NAME @@ -46,11 +46,13 @@ previously created with .Sh RETURN VALUES If successful, the .Fn pthread_rwlockattr_destroy -function will return zero. Otherwise an error number will be returned +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_rwlockattr_destroy -may fail if: +function may fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by diff --git a/lib/libpthread/pthread_rwlockattr_getpshared.3 b/lib/libpthread/pthread_rwlockattr_getpshared.3 index 73bae5f292..785e1bd5c5 100644 --- a/lib/libpthread/pthread_rwlockattr_getpshared.3 +++ b/lib/libpthread/pthread_rwlockattr_getpshared.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlockattr_getpshared.3,v 1.4.2.4 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlockattr_getpshared.3,v 1.15 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlockattr_getpshared.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCKATTR_GETPSHARED 3 .Os .Sh NAME @@ -41,26 +41,30 @@ 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 +lock attribute object. +The setting is returned via .Fa pshared , and may be one of two values: -.Bl -tag -width PTHREAD_PROCESS_PRIVATE +.Bl -tag -width ".Dv 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 +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 +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_rwlockattr_getpshared -may fail if: +function may fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by diff --git a/lib/libpthread/pthread_rwlockattr_init.3 b/lib/libpthread/pthread_rwlockattr_init.3 index 9e05445c50..2260a40405 100644 --- a/lib/libpthread/pthread_rwlockattr_init.3 +++ b/lib/libpthread/pthread_rwlockattr_init.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlockattr_init.3,v 1.3.2.3 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlockattr_init.3,v 1.13 2007/10/22 10:08:00 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlockattr_init.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCKATTR_INIT 3 .Os .Sh NAME @@ -44,11 +44,13 @@ 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 +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_rwlockattr_init -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Insufficient memory exists to initialize the attribute object. diff --git a/lib/libpthread/pthread_rwlockattr_setpshared.3 b/lib/libpthread/pthread_rwlockattr_setpshared.3 index 0843ccfd14..78a058e9c8 100644 --- a/lib/libpthread/pthread_rwlockattr_setpshared.3 +++ b/lib/libpthread/pthread_rwlockattr_setpshared.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlockattr_setpshared.3,v 1.3.2.4 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_rwlockattr_setpshared.3,v 1.15 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_rwlockattr_setpshared.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_RWLOCKATTR_SETPSHARED 3 .Os .Sh NAME @@ -44,25 +44,29 @@ function sets the process shared attribute of .Fa attr to the value referenced by .Fa pshared . +The .Fa pshared -may be one of two values: -.Bl -tag -width PTHREAD_PROCESS_PRIVATE +argument may be one of two values: +.Bl -tag -width ".Dv 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 +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 +function will return zero. +Otherwise an error number will be returned to indicate the error. .Sh ERRORS +The .Fn pthread_rwlockattr_setpshared -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL The value specified by @@ -72,8 +76,8 @@ or is invalid. .El .Sh SEE ALSO +.Xr pthread_rwlockattr_getpshared 3 , .Xr pthread_rwlockattr_init 3 , -.Xr pthread_rwlockattr_setpshared 3 , .Xr pthread_rwlock_init 3 .Sh STANDARDS The diff --git a/lib/libpthread/pthread_schedparam.3 b/lib/libpthread/pthread_schedparam.3 index 1b5fd91ecd..737ca4d133 100644 --- a/lib/libpthread/pthread_schedparam.3 +++ b/lib/libpthread/pthread_schedparam.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD: src/lib/libc_r/man/pthread_schedparam.3,v 1.2.2.5 2001/12/17 10:08:26 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_schedparam.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SCHEDPARAM 3 .Os .Sh NAME @@ -50,42 +50,51 @@ and 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 +(first in, first out), .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 . +(round-robin), or +.Dv SCHED_OTHER +(timesharing). +Valid thread priorities (accessed via +.Fa param->sched_priority ) +must be within the range returned by the +.Xr sched_get_priority_min 2 +and +.Xr sched_get_priority_max 2 +system calls. .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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL Invalid value for -.Va policy . +.Fa policy . .It Bq Er ENOTSUP Invalid value for scheduling parameters. .It Bq Er ESRCH Non-existent thread -.Va thread . +.Fa thread . .El .Pp +The .Fn pthread_getschedparam -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ESRCH Non-existent thread -.Va thread . +.Fa thread . .El +.Sh SEE ALSO +.Xr sched_get_priority_max 2 , +.Xr sched_get_priority_min 2 .Sh STANDARDS +The .Fn pthread_setschedparam and .Fn pthread_getschedparam -conform to -.St -susv2 +functions conform to +.St -susv2 . diff --git a/lib/libpthread/pthread_self.3 b/lib/libpthread/pthread_self.3 index 5170b7ab53..29467d4c34 100644 --- a/lib/libpthread/pthread_self.3 +++ b/lib/libpthread/pthread_self.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_self.3,v 1.4.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_self.3,v 1.14 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_self.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SELF 3 .Os .Sh NAME @@ -57,6 +57,7 @@ None. .Xr pthread_create 3 , .Xr pthread_equal 3 .Sh STANDARDS +The .Fn pthread_self -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_set_name_np.3 b/lib/libpthread/pthread_set_name_np.3 index fe2f62a57f..4e3a408eda 100644 --- a/lib/libpthread/pthread_set_name_np.3 +++ b/lib/libpthread/pthread_set_name_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_set_name_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_set_name_np.3,v 1.6 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_set_name_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SET_NAME_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_setspecific.3 b/lib/libpthread/pthread_setspecific.3 index 17cd1efc58..aeccb98f28 100644 --- a/lib/libpthread/pthread_setspecific.3 +++ b/lib/libpthread/pthread_setspecific.3 @@ -28,10 +28,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_setspecific.3,v 1.6.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_setspecific.3,v 1.17 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_setspecific.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SETSPECIFIC 3 .Os .Sh NAME @@ -50,7 +50,7 @@ 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. +Different threads can 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. @@ -65,18 +65,20 @@ has been deleted with .Fn pthread_key_delete is undefined. .Pp +The .Fn pthread_setspecific -may be called from a thread-specific data destructor function, however this -may result in lost storage or infinite loops. +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 +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 -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er ENOMEM Insufficient memory exists to associate the value with the @@ -91,6 +93,7 @@ value is invalid. .Xr pthread_key_create 3 , .Xr pthread_key_delete 3 .Sh STANDARDS +The .Fn pthread_setspecific -conforms to +function conforms to .St -p1003.1-96 . diff --git a/lib/libpthread/pthread_sigmask.3 b/lib/libpthread/pthread_sigmask.3 index 81837b41e4..0604841f8c 100644 --- a/lib/libpthread/pthread_sigmask.3 +++ b/lib/libpthread/pthread_sigmask.3 @@ -25,9 +25,9 @@ .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_sigmask.3,v 1.3.2.6 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_sigmask.3,v 1.14 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_sigmask.3,v 1.3 2007/09/08 20:50:50 swildner Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SIGMASK 3 .Os .Sh NAME @@ -78,8 +78,9 @@ If successful, returns 0. Otherwise, an error is returned. .Sh ERRORS +The .Fn pthread_sigmask -will fail if: +function will fail if: .Bl -tag -width Er .It Bq Er EINVAL .Fa how @@ -92,6 +93,7 @@ is not one of the defined values. .Xr sigsuspend 2 , .Xr sigsetops 3 .Sh STANDARDS +The .Fn pthread_sigmask -conforms to -.St -p1003.1-96 +function conforms to +.St -p1003.1-96 . diff --git a/lib/libpthread/pthread_rwlock_wrlock.3 b/lib/libpthread/pthread_spin_init.3 similarity index 50% copy from lib/libpthread/pthread_rwlock_wrlock.3 copy to lib/libpthread/pthread_spin_init.3 index 6d48ed964b..bbb6da975d 100644 --- a/lib/libpthread/pthread_rwlock_wrlock.3 +++ b/lib/libpthread/pthread_spin_init.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998 Alex Nash +.\" Copyright (c) 2004 Michael Telahun Makonnen .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,84 +22,101 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_rwlock_wrlock.3,v 1.2.2.2 2001/12/17 10:08:26 ru Exp $ -.\" $DragonFly: src/lib/libc_r/man/pthread_rwlock_wrlock.3,v 1.3 2006/02/17 19:35:07 swildner Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_spin_init.3,v 1.3 2007/10/22 10:08:01 ru Exp $ .\" -.Dd April 15, 2009 -.Dt PTHREAD_RWLOCK_WRLOCK 3 +.Dd July 10, 2009 +.Dt PTHREAD_SPIN_INIT 3 .Os .Sh NAME -.Nm pthread_rwlock_wrlock , -.Nm pthread_rwlock_trywrlock -.Nd acquire a read/write lock for writing +.Nm pthread_spin_init , pthread_spin_destroy +.Nd "initialize or destroy a spin lock" .Sh LIBRARY .Lb libpthread .Sh SYNOPSIS .In pthread.h .Ft int -.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock" +.Fn pthread_spin_init "pthread_spinlock_t *lock" "int pshared" .Ft int -.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock" +.Fn pthread_spin_destroy "pthread_spinlock_t *lock" .Sh DESCRIPTION The -.Fn pthread_rwlock_wrlock -function blocks until a write lock can be acquired against +.Fn pthread_spin_init +function will initialize +.Fa lock +to an unlocked state and +allocate any resources necessary to begin using it. +If +.Fa pshared +is set to +.Dv PTHREAD_PROCESS_SHARED , +any thread, +whether belonging to the process in which the spinlock was created or not, +that has access to the memory area where +.Fa lock +resides, can use .Fa lock . -The -.Fn pthread_rwlock_trywrlock -function performs the same action, but does not block if the lock -cannot be immediately obtained. +If it is set to +.Dv PTHREAD_PROCESS_PRIVATE , +it can only be used by threads within the same process. .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. +The +.Fn pthread_spin_destroy +function will destroy +.Fa lock +and release any resources that may have been allocated on its behalf. .Sh RETURN VALUES -If successful, the -.Fn pthread_rwlock_wrlock +If successful, +both +.Fn pthread_spin_init and -.Fn pthread_rwlock_trywrlock -functions will return zero. Otherwise an error number will be returned -to indicate the error. -.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 +.Fn pthread_spin_destroy +will return zero. +Otherwise, an error number will be returned to indicate the error. .Pp +Neither of these functions will return +.Er EINTR . +.Sh ERRORS The -.Fn pthread_rwlock_wrlock +.Fn pthread_spin_init and -.Fn pthread_rwlock_trywrlock -functions may fail if: +.Fn pthread_spin_destroy +functions will 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 EBUSY +An attempt to initialize or destroy +.Fa lock +while it is in use. .It Bq Er EINVAL The value specified by .Fa lock is invalid. +.El +.Pp +The +.Fn pthread_spin_init +function will fail if: +.Bl -tag -width Er +.It Bq Er EAGAIN +Insufficient resources, +other than memory, +to initialize +.Fa lock . .It Bq Er ENOMEM -Insufficient memory exists to initialize the lock (applies to -statically initialized locks only). +Insufficient memory to initialize +.Fa lock . .El .Sh SEE ALSO -.Xr pthread_rwlock_trywrlock 3 , -.Xr pthread_rwlock_unlock 3 , -.Xr pthread_rwlock_wrlock 3 -.Sh STANDARDS -The -.Fn pthread_rwlock_wrlock -and -.Fn pthread_rwlock_trywrlock -functions are expected to conform to -.St -susv2 . -.Sh HISTORY -The -.Fn pthread_rwlock_wrlock -function first appeared in -.Fx 3.0 . +.Xr pthread_spin_lock 3 , +.Xr pthread_spin_unlock 3 +.Sh BUGS +The implementation of +.Fn pthread_spin_init +does not fully conform to +.St -p1003.2 +because the +.Fa pshared +argument is ignored; +if any value other than +.Dv PTHREAD_PROCESS_PRIVATE +is specified, it returns +.Er EINVAL . diff --git a/lib/libpthread/pthread_spin_lock.3 b/lib/libpthread/pthread_spin_lock.3 new file mode 100644 index 0000000000..ee97c0a3ed --- /dev/null +++ b/lib/libpthread/pthread_spin_lock.3 @@ -0,0 +1,124 @@ +.\" Copyright (c) 2004 Michael Telahun Makonnen +.\" 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: src/share/man/man3/pthread_spin_lock.3,v 1.4 2007/10/22 10:08:01 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_SPIN_LOCK 3 +.Os +.Sh NAME +.Nm pthread_spin_lock , pthread_spin_trylock , pthread_spin_unlock +.Nd "lock or unlock a spin lock" +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft int +.Fn pthread_spin_lock "pthread_spinlock_t *lock" +.Ft int +.Fn pthread_spin_trylock "pthread_spinlock_t *lock" +.Ft int +.Fn pthread_spin_unlock "pthread_spinlock_t *lock" +.Sh DESCRIPTION +The +.Fn pthread_spin_lock +function will acquire +.Fa lock +if it is not currently owned by another thread. +If the lock cannot be acquired immediately, it will +spin attempting to acquire the lock (it will not sleep) until +it becomes available. +.Pp +The +.Fn pthread_spin_trylock +function is the same as +.Fn pthread_spin_lock +except that if it cannot acquire +.Fa lock +immediately it will return with an error. +.Pp +The +.Fn pthread_spin_unlock +function will release +.Fa lock , +which must have been previously locked by a call to +.Fn pthread_spin_lock +or +.Fn pthread_spin_trylock . +.Sh RETURN VALUES +If successful, all these functions will return zero. +Otherwise, an error number will be returned to indicate the error. +.Pp +None of these functions will return +.Er EINTR . +.Sh ERRORS +The +.Fn pthread_spin_lock , +.Fn pthread_spin_trylock +and +.Fn pthread_spin_unlock +functions will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The value specified by +.Fa lock +is invalid or is not initialized. +.El +.Pp +The +.Fn pthread_spin_lock +function may fail if: +.Bl -tag -width Er +.It Bq Er EDEADLK +The calling thread already owns the lock. +.El +.Pp +The +.Fn pthread_spin_trylock +function will fail if: +.Bl -tag -width Er +.It Bq Er EBUSY +Another thread currently holds +.Fa lock . +.El +.Pp +The +.Fn pthread_spin_unlock +function may fail if: +.Bl -tag -width Er +.It Bq Er EPERM +The calling thread does not own +.Fa lock . +.El +.Sh SEE ALSO +.Xr pthread_spin_destroy 3 , +.Xr pthread_spin_init 3 +.Sh BUGS +The implementation of +.Fn pthread_spin_lock , +.Fn pthread_spin_trylock +and +.Fn pthread_spin_unlock +is expected to conform to +.St -p1003.2 . diff --git a/lib/libpthread/pthread_suspend_all_np.3 b/lib/libpthread/pthread_suspend_all_np.3 index 87cae74580..067881ae4e 100644 --- a/lib/libpthread/pthread_suspend_all_np.3 +++ b/lib/libpthread/pthread_suspend_all_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_suspend_all_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_suspend_all_np.3,v 1.6 2006/09/30 11:22:26 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_suspend_all_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SUSPEND_ALL_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_suspend_np.3 b/lib/libpthread/pthread_suspend_np.3 index d6b6c3e40d..8207acc13f 100644 --- a/lib/libpthread/pthread_suspend_np.3 +++ b/lib/libpthread/pthread_suspend_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_suspend_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_switch_add_np.3,v 1.5 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_suspend_np.3,v 1.2 2003/06/17 04:26:48 dillon Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SUSPEND_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_switch_add_np.3 b/lib/libpthread/pthread_switch_add_np.3 index 341ae281a2..687a585046 100644 --- a/lib/libpthread/pthread_switch_add_np.3 +++ b/lib/libpthread/pthread_switch_add_np.3 @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc_r/man/pthread_switch_add_np.3,v 1.2.2.1 2003/03/03 22:06:37 phantom Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_switch_add_np.3,v 1.5 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_switch_add_np.3,v 1.3 2005/08/01 01:49:16 swildner Exp $ .\" -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_SWITCH_ADD_NP 3 .Os .Sh NAME diff --git a/lib/libpthread/pthread_testcancel.3 b/lib/libpthread/pthread_testcancel.3 index bcb6ff35f4..096f322d22 100644 --- a/lib/libpthread/pthread_testcancel.3 +++ b/lib/libpthread/pthread_testcancel.3 @@ -1,6 +1,6 @@ -.\" $FreeBSD: src/lib/libc_r/man/pthread_testcancel.3,v 1.2.2.5 2001/12/17 10:08:26 ru Exp $ +.\" $FreeBSD: src/share/man/man3/pthread_testcancel.3,v 1.15 2007/10/22 10:08:01 ru Exp $ .\" $DragonFly: src/lib/libc_r/man/pthread_testcancel.3,v 1.3 2006/03/26 22:56:56 swildner Exp $ -.Dd April 15, 2009 +.Dd July 10, 2009 .Dt PTHREAD_TESTCANCEL 3 .Os .Sh NAME @@ -154,7 +154,7 @@ 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 +because the client does not 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 @@ -197,11 +197,12 @@ or .Sh SEE ALSO .Xr pthread_cancel 3 .Sh STANDARDS +The .Fn pthread_testcancel -conforms to +function conforms to .St -p1003.1-96 . .Sh AUTHORS -This man page was written by +This manual page was written by .An David Leonard Aq d@openbsd.org for the .Ox diff --git a/lib/libpthread/pthread_yield.3 b/lib/libpthread/pthread_yield.3 new file mode 100644 index 0000000000..099f937951 --- /dev/null +++ b/lib/libpthread/pthread_yield.3 @@ -0,0 +1,30 @@ +.\" $OpenBSD: pthread_yield.3,v 1.3 2004/01/25 14:48:32 jmc Exp $ +.\" +.\" PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman +.\" +.\" $FreeBSD: src/share/man/man3/pthread_yield.3,v 1.2 2007/10/22 10:08:01 ru Exp $ +.\" +.Dd July 10, 2009 +.Dt PTHREAD_YIELD 3 +.Os +.Sh NAME +.Nm pthread_yield +.Nd yield control of the current thread +.Sh LIBRARY +.Lb libpthread +.Sh SYNOPSIS +.In pthread.h +.Ft void +.Fn pthread_yield void +.Sh DESCRIPTION +The +.Fn pthread_yield +forces the running thread to relinquish the processor until it again +becomes the head of its thread list. +.Sh SEE ALSO +.Xr sched_yield 2 +.Sh STANDARDS +The +.Fn pthread_yield +is a non-portable (but quite common) extension to +.St -p1003.1-2001 . -- 2.41.0