diff options
author | Maxim Devaev <[email protected]> | 2024-10-26 15:51:33 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-10-26 15:51:33 +0300 |
commit | a84242c9bc5215c7230dd9552cbbeec786060ec3 (patch) | |
tree | 7918ea96b79a3e20f2142d5fac2cdf242c5ece80 /kvmd/aiotools.py | |
parent | 399712c6849b52efcb1b1ee9f4abdafa84c5812f (diff) |
AioExclusiveRegion API is sync now
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r-- | kvmd/aiotools.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py index b1747f16..a47c94c6 100644 --- a/kvmd/aiotools.py +++ b/kvmd/aiotools.py @@ -297,7 +297,7 @@ class AioExclusiveRegion: def is_busy(self) -> bool: return self.__busy - async def enter(self) -> None: + def enter(self) -> None: if not self.__busy: self.__busy = True try: @@ -309,22 +309,22 @@ class AioExclusiveRegion: return raise self.__exc_type() - async def exit(self) -> None: + def exit(self) -> None: self.__busy = False if self.__notifier: self.__notifier.notify() - async def __aenter__(self) -> None: - await self.enter() + def __enter__(self) -> None: + self.enter() - async def __aexit__( + def __exit__( self, _exc_type: type[BaseException], _exc: BaseException, _tb: types.TracebackType, ) -> None: - await self.exit() + self.exit() async def run_region_task( @@ -339,7 +339,7 @@ async def run_region_task( async def wrapper() -> None: try: - async with region: + with region: entered.set_result(None) await func(*args, **kwargs) except region.get_exc_type(): |