[sheepdog] [PATCH 1/2] add helper macros to try lock and unlock based on urcu

Liu Yuan namei.unix at gmail.com
Thu Nov 1 06:41:13 CET 2012


On 11/01/2012 01:07 PM, MORITA Kazutaka wrote:
> +/* return true if the lock was acquired */
> +#define uatomic_trylock(lock)  (uatomic_cmpxchg((lock), 0, 1) == 0)
> +#define uatomic_is_locked(lock)  (uatomic_read(lock) == 1)
> +#define uatomic_unlock(lock) uatomic_set((lock), 0)
> +

I think uatomic locker candy is useful for complex uatomic_cmpxchg()
operation, but not so for true/false condition. How about add another
candy for true/false condition like, uatomic_set_{true,false},
uatomic_is_true candy helpers?

Thanks,
Yuan



More information about the sheepdog mailing list