From nobody@FreeBSD.org Sat Jan 23 11:20:54 2010 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47831106568D for ; Sat, 23 Jan 2010 11:20:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 371948FC2D for ; Sat, 23 Jan 2010 11:20:54 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0NBKsBY017815 for ; Sat, 23 Jan 2010 11:20:54 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0NBKrZV017814; Sat, 23 Jan 2010 11:20:54 GMT (envelope-from nobody) Message-Id: <201001231120.o0NBKrZV017814@www.freebsd.org> Date: Sat, 23 Jan 2010 11:20:54 GMT From: Nick Black To: freebsd-gnats-submit@FreeBSD.org Subject: [patch] pthread_join() can return EOPNOTSUPP X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 143115 >Category: threads >Synopsis: [patch] pthread_join() can return EOPNOTSUPP >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-threads >State: closed >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 23 11:30:02 UTC 2010 >Closed-Date: Sat May 15 21:19:16 UTC 2010 >Last-Modified: Sat May 15 21:19:16 UTC 2010 >Originator: Nick Black >Release: 8.0-RELEASE >Organization: Georgia Institute of Technology >Environment: [freebsd8](0) $ uname -a FreeBSD freebsd8.kvmnet 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 [freebsd8](0) $ >Description: The pthread_join(3) man page ought list that EOPNOTSUPP can be returned from pthread_join(3) when multiple callers join on the same thread. I've included a trivial patch. >How-To-Repeat: man pthread_join >Fix: Apply patch Patch attached with submission follows: --- pthread_join.3-EOPNOTSUPP.diff begins here --- --- pthread_join.3 2010-01-23 06:08:01.000000000 -0500 +++ pthread_join.3.pristine 2010-01-23 06:06:25.000000000 -0500 @@ -95,9 +95,6 @@ A deadlock was detected or the value of .Fa thread specifies the calling thread. -.It Bq Er EOPNOTSUPP -Another caller is already waiting on -.Fa thread . .El .Sh SEE ALSO .Xr wait 2 , >Release-Note: >Audit-Trail: From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/143115: commit references a PR Date: Sat, 23 Jan 2010 13:09:02 +0000 (UTC) Author: kib Date: Sat Jan 23 13:08:47 2010 New Revision: 202884 URL: http://svn.freebsd.org/changeset/base/202884 Log: Document pthread_timedjoin_np. Note implementation-defined EOPNOTSUPP error [1]. PR: threads/143115 [1] MFC after: 3 days Modified: head/share/man/man3/pthread_join.3 Modified: head/share/man/man3/pthread_join.3 ============================================================================== --- head/share/man/man3/pthread_join.3 Sat Jan 23 12:48:46 2010 (r202883) +++ head/share/man/man3/pthread_join.3 Sat Jan 23 13:08:47 2010 (r202884) @@ -30,11 +30,12 @@ .\" .\" $FreeBSD$ .\" -.Dd April 4, 1996 +.Dd January 23, 2010 .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 @@ -42,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 @@ -70,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 @@ -95,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_join +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 , @@ -104,3 +132,9 @@ The .Fn pthread_join function conforms to .St -p1003.1-96 . +The +.Fn pthread_timedjoin_np +is +.Fx +extension, first appeared in +.Fx 6.1 . _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State-Changed-From-To: open->closed State-Changed-By: jilles State-Changed-When: Sat May 15 21:19:15 UTC 2010 State-Changed-Why: Fixed in 7.x/8.x/9.x. Thanks! http://www.freebsd.org/cgi/query-pr.cgi?pr=143115 >Unformatted: