summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-09-17 18:07:20 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-09-17 18:07:20 -0700
commit3139512c9f29836a7e61669c8fcac24d45898b44 (patch)
treebe5e2abd8606594f69084e30e112e404eaba534e
parentfab18f8c80ff287f5a41935f1e648984018fad16 (diff)
downloadtooz-3139512c9f29836a7e61669c8fcac24d45898b44.tar.gz
Standardize on hiding the lock implementation
It seems like the other drivers (if they use a proxy object to do the locking) hide the lock in the external non-proxy object so this changes mirrors that hiding of the proxy object instead of exposing it. Change-Id: I2bd8f8c9f66aed960d14784053b9b32999ac394e
-rw-r--r--tooz/drivers/ipc.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tooz/drivers/ipc.py b/tooz/drivers/ipc.py
index 1f1c4f7..ba2302c 100644
--- a/tooz/drivers/ipc.py
+++ b/tooz/drivers/ipc.py
@@ -46,12 +46,12 @@ class IPCLock(locking.Lock):
super(IPCLock, self).__init__(name)
self.key = self.ftok(name, self._LOCK_PROJECT)
try:
- self.lock = sysv_ipc.Semaphore(self.key,
- flags=sysv_ipc.IPC_CREX,
- initial_value=1)
+ self._lock = sysv_ipc.Semaphore(self.key,
+ flags=sysv_ipc.IPC_CREX,
+ initial_value=1)
except sysv_ipc.ExistentialError:
- self.lock = sysv_ipc.Semaphore(self.key)
- self.lock.undo = True
+ self._lock = sysv_ipc.Semaphore(self.key)
+ self._lock.undo = True
self.timeout = timeout
@staticmethod
@@ -70,7 +70,7 @@ class IPCLock(locking.Lock):
def acquire(self, blocking=True):
timeout = self.timeout if blocking else 0
try:
- self.lock.acquire(timeout=timeout)
+ self._lock.acquire(timeout=timeout)
except (sysv_ipc.BusyError, sysv_ipc.ExistentialError):
return False
else:
@@ -78,7 +78,7 @@ class IPCLock(locking.Lock):
def release(self):
try:
- self.lock.release()
+ self._lock.release()
except sysv_ipc.ExistentialError:
return False
else:
@@ -99,7 +99,7 @@ class IPCLock(locking.Lock):
concurrently using the same lock while it is being destroyed...
"""
try:
- self.lock.remove()
+ self._lock.remove()
except sysv_ipc.ExistentialError:
pass