From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-06 05:53:09


Tyson Whitehead wrote:
>
> A simple solution is to initialize the counter to zero and replace
> the above lock by:
>
> while( __exchange_and_add(&m_.a_, 1) ){
> __atomic_add(&m_.a_, -1);
> sched_yield();
> }
>
> and the unlock by:
> __atomic_add(&m_.a_, -1);

Applied, thanks.