Fix don't crash on semaphore acquire error

This commit is contained in:
allegroai 2022-02-26 13:42:27 +02:00
parent f37e036e51
commit 999e8d39ba

View File

@ -84,7 +84,11 @@ class ForkSemaphore(_ForkSafeThreadSyncObject):
super(ForkSemaphore, self).__init__(functor=partial(Semaphore, value))
def acquire(self, *args, **kwargs):
try:
self._create()
except BaseException: # noqa
return None
return self._sync.acquire(*args, **kwargs)
def release(self, *args, **kwargs):