Check that storage lock guarantees are met

This commit is contained in:
Unrud 2018-08-18 12:56:41 +02:00
parent 5d969ff65c
commit ddd99a5329

View File

@ -1591,6 +1591,9 @@ class FileBackedRwLock:
raise RuntimeError("Locking the storage failed: " raise RuntimeError("Locking the storage failed: "
"Unsupported operating system") "Unsupported operating system")
with self._lock: with self._lock:
if self._writer or mode == "w" and self._readers != 0:
raise RuntimeError("Locking the storage failed: "
"Guarantees failed")
if mode == "r": if mode == "r":
self._readers += 1 self._readers += 1
else: else: