FreeBSD pthread_equal "bug"

Mike Makonnen mtm at identd.net
Wed Jun 4 07:58:40 PDT 2003


On 04 Jun 2003 16:15:14 +0200
Kern Sibbald <kern at sibbald.com> 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 at identd.net | D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC 68B9
mtm at FreeBSD.Org| FreeBSD - The Power To Serve


More information about the freebsd-threads mailing list