RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
ZKLock Class Reference

#include <zk_lock.h>

Public Member Functions

 ZKLock (ZKWrapper &zkWrapper, std::string path)
 
int lock ()
 
int unlock ()
 

Detailed Description

ZKLock is a globally synchronous lock that is implemented using ZooKeeper. Multiple clients can synchronize on a resource by locking onto the same path.

Constructor & Destructor Documentation

ZKLock::ZKLock ( ZKWrapper zkWrapper,
std::string  path 
)
inline
Parameters
zkWrapper
paththe path to lock onto. This path does not need to exist inside ZooKeeper.
Returns

TODO(2017) What exactly do we need here in terms of cloning zkWrapper? Default copying causes problem for resource reclamation (risking leakage or double free).

Member Function Documentation

int ZKLock::lock ( void  )

Blocks until the thread is able to lock onto the path.

Returns
a negative value if an error occurs; 0 otherwise
int ZKLock::unlock ( void  )
Returns
a negative value if an error occurs; 0 otherwise

The documentation for this class was generated from the following files: