From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 7 21:51:35 2007 Return-Path: X-Original-To: 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 EEA0A16A400 for ; Wed, 7 Feb 2007 21:51:35 +0000 (UTC) (envelope-from news@Watt.COM) Received: from wattres.watt.com (wattres.watt.com [66.93.133.130]) by mx1.freebsd.org (Postfix) with ESMTP id CA1C413C442 for ; Wed, 7 Feb 2007 21:51:35 +0000 (UTC) (envelope-from news@Watt.COM) Received: from wattres.watt.com (localhost.watt.com [127.0.0.1]) by wattres.watt.com (8.13.8/8.13.8) with ESMTP id l17LpU1L063728 for ; Wed, 7 Feb 2007 13:51:35 -0800 (PST) (envelope-from news@wattres.watt.com) Received: (from news@localhost) by wattres.watt.com (8.13.8/8.13.8/Submit) id l17LpUnh063727 for hackers@freebsd.org; Wed, 7 Feb 2007 13:51:30 -0800 (PST) (envelope-from news) To: hackers@freebsd.org Path: not-for-mail From: Steve Watt Newsgroups: local.freebsd-hackers Date: Wed, 7 Feb 2007 21:51:30 +0000 (UTC) Organization: Watt Consultants, San Jose, CA, USA Lines: 29 Message-ID: References: NNTP-Posting-Host: localhost.watt.com X-Trace: wattres.Watt.COM 1170885090 63179 127.0.0.1 (7 Feb 2007 21:51:30 GMT) X-Complaints-To: usenet@wattres.Watt.COM NNTP-Posting-Date: Wed, 7 Feb 2007 21:51:30 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: steve@Watt.COM (Steve Watt) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (wattres.watt.com [127.0.0.1]); Wed, 07 Feb 2007 13:51:35 -0800 (PST) X-Archived: 1170885095.495024575@wattres.Watt.COM X-Mailman-Approved-At: Thu, 08 Feb 2007 04:00:33 +0000 Cc: 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: Wed, 07 Feb 2007 21:51:36 -0000 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...