[Sheepdog] [PATCH] zookeeper: switch gcc atomic builtins to atomic helpers
Liu Yuan
namei.unix at gmail.com
Tue May 8 14:24:08 CEST 2012
On 05/08/2012 08:21 PM, Yunkai Zhang wrote:
>> > The combination of a read and an atomic_sub later looks racy to me, what
>> > prevents nr_zk_levents from changing between the two calls?
> The watcher function was executed in another thread(create by
> zookeeper_init() ), we should use atomic function to read/wirte
> nr_zk_levents in any time.
>
Maybe you don't get Christoph.
if (!uatomic_read(&zk_notify_blocked) &&
uatomic_read(&nr_zk_levents)) {
nr_levents = uatomic_sub_return(&nr_zk_levents, 1) + 1;
I guess he means the possible race between uatomic_read() and
uatomic_sub_return() on the same value.
Thanks,
Yuan
More information about the sheepdog
mailing list