From owner-freebsd-threads@FreeBSD.ORG Wed Jun 4 08:02:10 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 CFD4437B401 for ; Wed, 4 Jun 2003 08:02:10 -0700 (PDT) Received: from pop018.verizon.net (pop018pub.verizon.net [206.46.170.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id E745543FB1 for ; Wed, 4 Jun 2003 08:02:09 -0700 (PDT) (envelope-from mtm@identd.net) Received: from kokeb.ambesa.net ([138.88.93.237]) by pop018.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030604150209.KLPY11703.pop018.verizon.net@kokeb.ambesa.net>; Wed, 4 Jun 2003 10:02:09 -0500 Date: Wed, 4 Jun 2003 11:02:08 -0400 From: Mike Makonnen To: kern@sibbald.com In-Reply-To: <20030604145838.NUHK3199.pop016.verizon.net@kokeb.ambesa.net> References: <1054730325.13630.456.camel@rufus> <20030604135208.LPAG20810.pop015.verizon.net@kokeb.ambesa.net> <1054736114.13630.499.camel@rufus> <20030604145838.NUHK3199.pop016.verizon.net@kokeb.ambesa.net> X-Mailer: Sylpheed version 0.8.10 (GTK+ 1.2.10; i386-portbld-freebsd5.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at pop018.verizon.net from [138.88.93.237] at Wed, 4 Jun 2003 10:02:08 -0500 Message-Id: <20030604150209.KLPY11703.pop018.verizon.net@kokeb.ambesa.net> cc: freebsd-threads@freebsd.org Subject: Re: FreeBSD pthread_equal "bug" 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: Wed, 04 Jun 2003 15:02:11 -0000 This time with the test program attached. Sorry. On Wed, 4 Jun 2003 10:58:37 -0400 Mike Makonnen wrote: > On 04 Jun 2003 16:15:14 +0200 > Kern Sibbald wrote: > > > Hello, > > > > I doubt that this is an accident on Solaris and Linux. > > They are both excellent implementations (though different) > > of pthreads, and it is very clear from the values contained > > that they are not simple memory addresses and are designed > > to be unique. > > I am not talking about Solaris and the comparison I am making is specifically > to the NPTL that I believe is supposed to be shipping with Red Hat now. > > >How they get to their internal structures I > > don't know and probably it is a few cycles faster than > > FreeBSD, but it makes pthread_equal() work correctly on > > their systems. > > > > I can say that their numbers are unique over a very large > > number of threads, and they repeat perfectly for each > > execution of the program so it isn't likely to be anything > > left to chance. > > > > Can you quote specific code in their Pthreads implementation? > Without the actual code, this is all just conjecture. It could be that they > simply return an index into an array of thread pointers, but that just means > that it takes a lot longer for the numbers to repeat. > > > As previously mentioned, I'm not convinced this is something urgent, > > but I am convinced it is a bug. However, it certainly bit me and > > took me a bit to figure out. > > Maybe and maybe not, but the test program that follows works "correctly" for > me. pthread_equal() says the two thread's are not the same. Which also > reminds me, I never saw your test program. Can you resend it or put it up on a > website? > > Cheers. > -- > Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc > mtm@identd.net | D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9 > mtm@FreeBSD.Org| FreeBSD - The Power To Serve > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" #include #include void * null(void *arg) { return (NULL); } int main(int argc, char **argv) { pthread_t th1, th2; int error; error = pthread_create(&th1, NULL, null, NULL); if (error != 0) abort(); /* give it a chance to exit */ sleep(3); error = pthread_create(&th2, NULL, null, NULL); if (error != 0) abort(); error = pthread_equal(th1, th2); if (error) printf("They are equal\n"); else printf("They are not equal\n"); return (0); }