From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 8 08:02:14 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C228316A400 for ; Thu, 8 Feb 2007 08:02:14 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout4.cac.washington.edu (mxout4.cac.washington.edu [140.142.33.19]) by mx1.freebsd.org (Postfix) with ESMTP id 9D72113C478 for ; Thu, 8 Feb 2007 08:02:14 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.32.141] (may be forged)) by mxout4.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id l1882EmU010129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 8 Feb 2007 00:02:14 -0800 X-Auth-Received: from [192.168.10.44] (c-67-187-172-183.hsd1.ca.comcast.net [67.187.172.183]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW06.09) with ESMTP id l1882CCt002388 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Thu, 8 Feb 2007 00:02:13 -0800 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: X-Gpgmail-State: !signed Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <87D4B047-DC72-427B-863F-A082C3A4E5CD@u.washington.edu> Content-Transfer-Encoding: 7bit From: Garrett Cooper Date: Thu, 8 Feb 2007 00:02:03 -0800 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.752.2) X-PMX-Version: 5.3.0.289146, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2007.2.7.234934 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0' Subject: Re: Trying to join an already exited pthread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2007 08:02:14 -0000 On Feb 7, 2007, at 1:51 PM, Steve Watt wrote: > In , > wrote: >> Just wondering: >> >> If I was to try and join a pthread that already exited, would >> there be an error >> message output and/or errno set to an error value, or would a >> system hang? > > Was the thread created with detach state set > PTHREAD_CREATE_DETACHED or > PTHREAD_CREATE_JOINABLE? If it was PTHREAD_CREATE_JOINABLE, has the > thread already been joined? > > You should be able to join a thread that was created joinable, only > once. > If you join it again, or join a thread that was created detached, the > results are unspecified in POSIX. There is an error status that may > be returned, but it may do other bad things to your system. > > Note that pthread_join doesn't set errno; it returns an error value > directly. I would never expect the system to hang, though the > application > might. If your application is hanging, make sure that you're not > trying > to call pthread_join from within a signal handler. > >> It this variable on Unix OSes? > > That the results are unspecified? No. What "unspecified" means? > Absolutely. > -- > Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.5" / 37N > 20' 15.3" > Internet: steve @ Watt.COM Whois: SW32-ARIN > Free time? There's no such thing. It just comes in varying > prices... I asked this because I was short on time and so was the person who asked me earlier. I'm going to try giving the pthread exit and join a shot just to see whether or not this is true or not and then I'll report my results to the list. Thanks for the insight though--hopefully my results will yield a solid positive or negative to this being a problem. -Garrett