apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w..@netscape.com (Wan-Teh Chang)
Subject Re: [PATCH] Thread Locks and SMP boxes
Date Wed, 30 Jul 2003 23:17:52 GMT
Joe Orton wrote:

 > This code looks like it is making lots of dubious assumptions:
 >
 > - pthread_t can be a structure, that's why the memset is used I presume,
 > assinging 0 to a pthread_t definitely wins no prizes
 > - who says a memset-to-zero'ed pthread_t isn't a valid pthread_t?  No
 > reason why it couldn't be.  If it is *not* a valid pthread_t, then
 > passing it to pthread_equal gives undefined behaviour anyway!

Agreed.  In some implementations pthread_t is an integer
index, and 0 could be a valid pthread_t (just like 0 is a
valid file descriptor on Unix).  So you can't assume that
0 is an invalid pthread_t.

Wan-Teh


Mime
View raw message