From 6e54fc72e872514f53f2be8a3eb2cd92c721440b Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 2 Dec 2017 09:55:05 +0100 Subject: [PATCH] pthread_join.3: Document pthread_timedjoin_np() (taken from FreeBSD). --- lib/libpthread/Makefile | 1 + lib/libpthread/pthread_join.3 | 45 ++++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index b678e294dc..3ce794ca07 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -118,6 +118,7 @@ MLINKS+= \ pthread_condattr.3 pthread_condattr_setclock.3 \ pthread_condattr.3 pthread_condattr_setpshared.3 \ pthread_getconcurrency.3 pthread_setconcurrency.3 \ + pthread_join.3 pthread_timedjoin_np.3 \ pthread_multi_np.3 pthread_single_np.3 \ pthread_mutex_getprioceiling.3 pthread_mutex_setprioceiling.3 \ pthread_mutexattr.3 pthread_mutexattr_destroy.3 \ diff --git a/lib/libpthread/pthread_join.3 b/lib/libpthread/pthread_join.3 index 77f33638aa..73a865aaff 100644 --- a/lib/libpthread/pthread_join.3 +++ b/lib/libpthread/pthread_join.3 @@ -28,14 +28,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $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 $ +.\" $FreeBSD: head/share/man/man3/pthread_join.3 209588 2010-06-29 14:32:01Z jhb $ .\" -.Dd July 10, 2009 +.Dd December 12, 2017 .Dt PTHREAD_JOIN 3 .Os .Sh NAME -.Nm pthread_join +.Nm pthread_join , +.Nm pthread_timedjoin_np .Nd wait for thread termination .Sh LIBRARY .Lb libpthread @@ -43,6 +43,8 @@ .In pthread.h .Ft int .Fn pthread_join "pthread_t thread" "void **value_ptr" +.Ft int +.Fn pthread_timedjoin_np "pthread_t thread" "void **value_ptr" "const struct timespec *abstime" .Sh DESCRIPTION The .Fn pthread_join @@ -71,18 +73,30 @@ If the thread calling .Fn pthread_join is cancelled, then the target thread is not detached. .Pp +The +.Fn pthread_timedjoin_np +function is equivalent to the +.Fn pthread_join +function except it will return +.Er ETIMEDOUT +if target thread does not exit before specified absolute time passes. +.Pp A thread that has exited but remains unjoined counts against [_POSIX_THREAD_THREADS_MAX]. .Sh RETURN VALUES If successful, the .Fn pthread_join -function will return zero. +and +.Fn pthread_timedjoin_np +functions will return zero. Otherwise an error number will be returned to indicate the error. .Sh ERRORS The .Fn pthread_join -function will fail if: +and +.Fn pthread_timedjoin_np +functions will fail if: .Bl -tag -width Er .It Bq Er EINVAL The implementation has detected that the value specified by @@ -96,6 +110,19 @@ thread ID, A deadlock was detected or the value of .Fa thread specifies the calling thread. +.It Bq Er EOPNOTSUPP +The implementation detected that another caller is already waiting on +.Fa thread . +.El +.Pp +Additionally, the +.Fn pthread_timedjoin_np +function will fail if: +.Bl -tag -width Er +.It Bq Er ETIMEDOUT +The specified absolute time passed while +.Fn pthread_timedjoin_np +waited for thread exit. .El .Sh SEE ALSO .Xr wait 2 , @@ -105,3 +132,9 @@ The .Fn pthread_join function conforms to .St -p1003.1-96 . +The +.Fn pthread_timedjoin_np +function is a +.Fx +extension which was added to +.Dx 1.3 . -- 2.41.0