mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmdbusd: Remove unused locking functionality
I don't think we have ever utilized this, remove.
This commit is contained in:
parent
cfc87157a4
commit
60e4ba36e0
@ -53,15 +53,6 @@ class ObjectManager(AutomatedProperties):
|
|||||||
(self, ), cb, cbe, False)
|
(self, ), cb, cbe, False)
|
||||||
cfg.worker_q.put(r)
|
cfg.worker_q.put(r)
|
||||||
|
|
||||||
def locked(self):
|
|
||||||
"""
|
|
||||||
If some external code need to run across a number of different
|
|
||||||
calls into ObjectManager while blocking others they can use this method
|
|
||||||
to lock others out.
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
return ObjectManagerLock(self.rlock)
|
|
||||||
|
|
||||||
@dbus.service.signal(
|
@dbus.service.signal(
|
||||||
dbus_interface="org.freedesktop.DBus.ObjectManager",
|
dbus_interface="org.freedesktop.DBus.ObjectManager",
|
||||||
signature='oa{sa{sv}}')
|
signature='oa{sa{sv}}')
|
||||||
@ -337,29 +328,3 @@ class ObjectManager(AutomatedProperties):
|
|||||||
# (uuid, lvm_id, str(path_create), path))
|
# (uuid, lvm_id, str(path_create), path))
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
class ObjectManagerLock(object):
|
|
||||||
"""
|
|
||||||
The sole purpose of this class is to allow other code the ability to
|
|
||||||
lock the object manager using a `with` statement, eg.
|
|
||||||
|
|
||||||
with cfg.om.locked():
|
|
||||||
# Do stuff with object manager
|
|
||||||
|
|
||||||
This will ensure that the lock is always released (assuming this is done
|
|
||||||
correctly)
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, recursive_lock):
|
|
||||||
self._lock = recursive_lock
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
# Acquire lock
|
|
||||||
self._lock.acquire()
|
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
|
||||||
def __exit__(self, e_type, e_value, e_traceback):
|
|
||||||
# Release lock
|
|
||||||
self._lock.release()
|
|
||||||
self._lock = None
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user