From: Nicolas Pitre Date: Wed, 07 Apr 2010 14:47:01 GMT Subject: Re: [PATCH v2] Make xmalloc and xrealloc thread-safe Message-ID: In-Reply-To: On Wed, 7 Apr 2010, Shawn Pearce wrote: > On Wed, Apr 7, 2010 at 6:17 AM, Nicolas Pitre wrote: > > Yet, the memset() issue comes up only because pthread_t is meant to be > > an opaque type.  The only information we would need here is the actual > > thread ID as returned by gettid() on Linux or GetCurrentThreadId() on > > Windows, and then the read_mutex_owner could be a simple atomically > > modifiable integer.  But what about other pthread-capable non Linux > > systems? > > Indeed. If Windows threads are atomic words, then actually you don't > need that double mutex in the emulation layer, and can instead use the > atomic word to determine ownership. Which makes this entire debate > somewhat moot, doesn't it? Well, indeed. Nicolas