From owner-freebsd-threads@FreeBSD.ORG Fri Jul 11 02:37:56 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 57BD537B401; Fri, 11 Jul 2003 02:37:56 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1BFC43F75; Fri, 11 Jul 2003 02:37:55 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from dialup-67.30.108.143.dial1.sanjose1.level3.net ([67.30.108.143] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19auLi-00067N-00; Fri, 11 Jul 2003 02:37:55 -0700 Message-ID: <3F0E8496.CBDCC23B@mindspring.com> Date: Fri, 11 Jul 2003 02:34:14 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: deischen@freebsd.org References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a49f79a1d2488bc0b77f1cf69d60f553752601a10902912494350badd9bab72f9c350badd9bab72f9c cc: Brooks Davis cc: freebsd-threads@freebsd.org Subject: Re: null pthread_t X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jul 2003 09:37:56 -0000 Daniel Eischen wrote: > This doesn't work where pthread_t's are integer id's (perhaps > used as indices into a lookup table to find the real pointer). > An index of 0 may be a valid thread id (which is why I assume > it was set to -1 in Linux). > > Unless you are advocating defining PTHREAD_NULL differently > depending on the threads implementation... But the code > should be rewritten to use a different method of validating > the thread (use a flag, or encapsulate it in an application > defined type along with a flag). I forgot to add the cast-value. And, no... it's definitely the wrong way to do things; if you need something like this,it's *much* better to use a covariable that's type invariant, e.g. "int started_thread_flag = 0;". And even -1 isn't safe; it might be a valid negative index. 8-). -- Terry