Commit 4fb780d1 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

locking.LockSet: Use function to get member lock name

Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 049088b2
......@@ -731,7 +731,7 @@ class LockSet:
self.__lockdict = {}
for mname in members:
self.__lockdict[mname] = SharedLock("%s/%s" % (name, mname))
self.__lockdict[mname] = SharedLock(self._GetLockName(mname))
# The owner dict contains the set of locks each thread owns. For
# performance each thread can access its own key without a global lock on
......@@ -742,6 +742,12 @@ class LockSet:
# will be trouble.
self.__owners = {}
def _GetLockName(self, mname):
"""Returns the name for a member lock.
return "%s/%s" % (, mname)
def _is_owned(self):
"""Is the current thread a current level owner?"""
return threading.currentThread() in self.__owners
......@@ -1049,7 +1055,7 @@ class LockSet:
for lockname in names:
lock = SharedLock("%s/%s" % (, lockname))
lock = SharedLock(self._GetLockName(lockname))
if acquired:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment