commit
b0ed18af05
@ -578,7 +578,9 @@ class Collection(BaseCollection):
|
|||||||
except OSError:
|
except OSError:
|
||||||
cls.logger.debug("Locking not supported")
|
cls.logger.debug("Locking not supported")
|
||||||
cls._lock_file_locked = True
|
cls._lock_file_locked = True
|
||||||
|
try:
|
||||||
yield
|
yield
|
||||||
|
finally:
|
||||||
with cls._lock:
|
with cls._lock:
|
||||||
if mode == "r":
|
if mode == "r":
|
||||||
cls._readers -= 1
|
cls._readers -= 1
|
||||||
@ -592,7 +594,8 @@ class Collection(BaseCollection):
|
|||||||
cls.logger.debug("Unlocking not supported")
|
cls.logger.debug("Unlocking not supported")
|
||||||
elif os.name == "posix":
|
elif os.name == "posix":
|
||||||
try:
|
try:
|
||||||
fcntl.lockf(cls._lock_file.fileno(), fcntl.LOCK_UN)
|
fcntl.lockf(cls._lock_file.fileno(),
|
||||||
|
fcntl.LOCK_UN)
|
||||||
except OSError:
|
except OSError:
|
||||||
cls.logger.debug("Unlocking not supported")
|
cls.logger.debug("Unlocking not supported")
|
||||||
cls._lock_file_locked = False
|
cls._lock_file_locked = False
|
||||||
|
Loading…
Reference in New Issue
Block a user