Skip to content

Commit

Permalink
Use bare asyncio.Lock and avoid coroutine for _get_property_lock
Browse files Browse the repository at this point in the history
  • Loading branch information
nocarryr committed Feb 23, 2017
1 parent 81223f2 commit f4ade61
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions vidhubcontrol/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
from pydispatch import Dispatcher, Property
from pydispatch.properties import ListProperty, DictProperty

class PropertyLock(asyncio.Lock):
def __init__(self, name):
super().__init__()
self.name = name

class BackendBase(Dispatcher):
device_name = Property()
Expand Down Expand Up @@ -254,10 +250,10 @@ def __init__(self, **kwargs):
value = self.get_property_for_choice(prop, value)
setattr(self, prop, value)
self.bind(**{prop:self.on_prop_control for prop in props})
async def _get_property_lock(self, name):
def _get_property_lock(self, name):
lock = self._property_locks.get(name)
if lock is None:
lock = PropertyLock(name)
lock = asyncio.Lock()
self._property_locks[name] = lock
return lock
async def set_property_from_backend(self, name, value):
Expand Down

0 comments on commit f4ade61

Please sign in to comment.