From owner-freebsd-threads@FreeBSD.ORG Thu Nov 27 01:36:41 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 7379516A4CE for ; Thu, 27 Nov 2003 01:36:41 -0800 (PST) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9646C43FDF for ; Thu, 27 Nov 2003 01:36:40 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-38lc14c.dialup.mindspring.com ([209.86.4.140] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1APIZi-0006BI-00; Thu, 27 Nov 2003 01:36:39 -0800 Message-ID: <3FC5A645.E1AAEA81@mindspring.com> Date: Wed, 26 Nov 2003 23:22:45 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "sapdb@komadev.de" References: <1069892789.3fc544b58a2d7@localhost> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a47de339922189b2d1ae9742e9932dd44ea8438e0f32a48e08350badd9bab72f9c350badd9bab72f9c cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids 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: Thu, 27 Nov 2003 09:36:41 -0000 "sapdb@komadev.de" wrote: > i wrote a little thread test programm. when i run it i get an output like > ... > 10 of 10 threads running, i am 0x8069000 > 10 of 10 threads running, i am 0x806c000 > 10 of 10 threads running, i am 0x806f000 > ... > > is there a generic way (not kse dependant), to get a still unique countinous > thread id starting with 1,2 .... n ? With linuxthreads, it was possible by a > dirty hack, masking out the upper 20 bit, but that seems not to be the way its > meant to work huh ? > > any ideas ? I think you meant "monotonic"/"contiguous"/"corresponding"? The answer is that the thread ID is an opaque value that belongs to the implementation, and you can not rely on its range or domain, so it's not possible to do things like create an array and index it by thread ID. I think the correct data structure for what you want, and which is not implementation dependent, is probably a hash table. -- Terry