From 30dc8824ec26a6a00f805497b93064bd7f3f1750 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Tue, 23 May 2023 13:43:31 +0200 Subject: [PATCH] Python CLI Package: Locking BIRD object --- python/BIRD/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/BIRD/__init__.py b/python/BIRD/__init__.py index 16b13595f..9d741782c 100644 --- a/python/BIRD/__init__.py +++ b/python/BIRD/__init__.py @@ -92,6 +92,7 @@ class CLI: self.socket = Socket(name) self.connected = False self.hello = None + self.lock = asyncio.Lock() async def open(self): if self.hello is not None: @@ -125,8 +126,10 @@ class BIRD: raise BIRDException("Tried to enter BIRD context (async with) more than once") self.within = True + await self.cli.lock.acquire() return self async def __aexit__(self, *args): await self.cli.close() + self.cli.lock.release() self.within = False -- 2.47.2