#include <zk_lock.h>
ZKLock is a globally synchronous lock that is implemented using ZooKeeper. Multiple clients can synchronize on a resource by locking onto the same path.
| ZKLock::ZKLock |
( |
ZKWrapper & |
zkWrapper, |
|
|
std::string |
path |
|
) |
| |
|
inline |
- Parameters
-
| zkWrapper | |
| path | the 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).
| 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:
- zkwrapper/include/zk_lock.h
- zkwrapper/source/zk_lock.cc