Date: Wed, 26 Nov 2003 23:22:45 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: "sapdb@komadev.de" <kai@freshx.de> Cc: freebsd-threads@freebsd.org Subject: Re: Continous thread ids Message-ID: <3FC5A645.E1AAEA81@mindspring.com> References: <1069892789.3fc544b58a2d7@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
"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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FC5A645.E1AAEA81>