[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4

From: Paul Eggert
Subject: Re: bug#7073: no pthread_spinlock_t on Mac OS 10.6.4
Date: Mon, 20 Sep 2010 16:38:07 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100915 Thunderbird/3.0.8

On 09/20/10 14:38, Chen Guo wrote:

> How difficult would it be to implement a basic spinlock in gnulib, though?

Portably?  I'd think it'd be quite a pain, as it would require
figuring out this platform's atomic instructions, dealing with memory
barriers, and the like.

> I suppose a performance hit with mutexes beats no performance at all
> with missing spinlocks.


> And regarding "take more work," I believe spinlocks and mutexes were
> basically interchangeable in terms of functionality in our sort
> algorithm; the work probably will be little more than a few #ifdefs
> and a s/pthread_mutex_t/pthread_spinlock_t/

Is that a reasonably-valid replacement in general, for code that uses
spin locks?  If so, we should implement this inside gnulib's pthread
module.  If not, it needs to be done inside coreutils, or perhaps
as a separate gnulib module.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]