From 585a3b901ac23b75ddfab7c78d5d3d24e3b3b4b2 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Fri, 24 Sep 2021 15:43:54 -0400 Subject: [PATCH] receiver: lock on actual handle, not just on handle number --- lib/logitech_receiver/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/logitech_receiver/base.py b/lib/logitech_receiver/base.py index b7e7527b..8bf6506c 100644 --- a/lib/logitech_receiver/base.py +++ b/lib/logitech_receiver/base.py @@ -360,11 +360,11 @@ handles_lock = {} def handle_lock(handle): with request_lock: - if handles_lock.get(int(handle)) is None: + if handles_lock.get(handle) is None: if _log.isEnabledFor(_INFO): - _log.info('New lock %s', int(handle)) - handles_lock[int(handle)] = _threading.Lock() # Serialize requests on the handle - return handles_lock[int(handle)] + _log.info('New lock %s', repr(handle)) + handles_lock[handle] = _threading.Lock() # Serialize requests on the handle + return handles_lock[handle] # context manager for locks with a timeout