From 6c69159fd37f9c0afd67c7a79327a5fec27797de Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 6 May 2024 22:42:16 +0200 Subject: [PATCH] Add comments about lock --- src/controller/python/chip/ChipStack.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index d34716677b2c72..35f9e24ef4db25 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -208,6 +208,7 @@ def __init__(self, persistentStoragePath: str, installDefaultLogHandler=True, bluetoothAdapter=None, enableServerInteractions=True): builtins.enableDebugMode = False + # TODO: Probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. self.networkLock = Lock() self.completeEvent = Event() self.commissioningCompleteEvent = Event() @@ -348,6 +349,7 @@ def setLogFunct(self, logFunct): logFunct = 0 if not isinstance(logFunct, _LogMessageFunct): logFunct = _LogMessageFunct(logFunct) + # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. with self.networkLock: # NOTE: ChipStack must hold a reference to the CFUNCTYPE object while it is # set. Otherwise it may get garbage collected, and logging calls from the @@ -390,6 +392,7 @@ def Call(self, callFunct, timeoutMs: int = None): # throw error if op in progress self.callbackRes = None self.completeEvent.clear() + # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. with self.networkLock: res = self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) self.completeEvent.set() @@ -422,6 +425,7 @@ def CallAsyncWithCompleteCallback(self, callFunct): # throw error if op in progress self.callbackRes = None self.completeEvent.clear() + # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. with self.networkLock: res = self.PostTaskOnChipThread(callFunct).Wait()