atomic_dec_and_test() in FreeBSD?

Garrett Rooney rooneg at electricjellyfish.net
Fri Apr 4 11:52:23 PST 2003


John Baldwin wrote:

>>I believe Craig is looking for a user space solution, not kernel space.
>>    
>>
>
>Argh, I couldn't remember.  Well, one could always use a mutex to
>protect the count I suppose.  One must be using some sort of threads
>library for this to even make sense in userland.
>

yeah, the default implementation of this function in APR uses mutexes to 
ensure that the increment is atomic, but craig is looking for a way to 
implement the 'platform specific faster way to do it without a mutex'.  
worst case, we can just use the default impl on freebsd 4.x and use 
atomic_cmpset_int on 5.x.

-garrett



More information about the freebsd-smp mailing list