You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Kah-Chan Low <ka...@yahoo.com> on 2014/01/14 15:23:20 UTC

ZooKeeper::getState() thread safe?

It is said that most zookeeper API functions, including getState() is thread safe.
I looked at the implementation but I fail to see how it can be thread safe.
Am I missing something?

Thanks!
kc

Re: ZooKeeper::getState() thread safe?

Posted by Kah-Chan Low <ka...@yahoo.com>.
Thanks Raul.
Now for the C binding zoo_state(). In C volatile doesn't have the same semantics & zoo_state() doesn't have a lock on it.  So that means that we are on our own for C then?

Is there a canonical list on which C API functions are thread safe & which ones are not?




On Tuesday, January 14, 2014 12:58 PM, Raúl Gutiérrez Segalés <rg...@itevenworks.net> wrote:
 
On 14 January 2014 06:23, Kah-Chan Low <ka...@yahoo.com> wrote:


> It is said that most zookeeper API functions, including getState() is
> thread safe.
> I looked at the implementation but I fail to see how it can be thread safe.
> Am I missing something?
>

http://www.javamex.com/tutorials/synchronization_volatile.shtml

-rgs

Re: ZooKeeper::getState() thread safe?

Posted by Raúl Gutiérrez Segalés <rg...@itevenworks.net>.
On 14 January 2014 06:23, Kah-Chan Low <ka...@yahoo.com> wrote:

> It is said that most zookeeper API functions, including getState() is
> thread safe.
> I looked at the implementation but I fail to see how it can be thread safe.
> Am I missing something?
>

http://www.javamex.com/tutorials/synchronization_volatile.shtml

-rgs