At lp:///~jameinel/bzr/1.18-lock-warnings
------------------------------------------------------------
revno: 4527
revision-id: [email protected]
parent: [email protected]
committer: John Arbash Meinel <[email protected]>
branch nick: 1.18-lock-warnings
timestamp: Fri 2009-07-10 16:49:24 -0500
message:
Make fcntl locks exclusive
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2009-07-10 17:50:54 +0000
+++ b/bzrlib/lock.py 2009-07-10 21:49:24 +0000
@@ -168,7 +168,8 @@
super(_fcntl_WriteLock, self).__init__()
# Check we can grab a lock before we actually open the file.
self.filename = osutils.realpath(filename)
- if self.filename in _fcntl_WriteLock._open_locks:
+ if (self.filename in _fcntl_WriteLock._open_locks
+ or self.filename in _fcntl_ReadLock._open_locks):
self._clear_f()
raise errors.LockContention(self.filename)
@@ -201,6 +202,8 @@
def __init__(self, filename):
super(_fcntl_ReadLock, self).__init__()
self.filename = osutils.realpath(filename)
+ if self.filename in _fcntl_WriteLock._open_locks:
+ raise errors.LockContention(self.filename)
_fcntl_ReadLock._open_locks.setdefault(self.filename, 0)
_fcntl_ReadLock._open_locks[self.filename] += 1
self._open(filename, 'rb')
--
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits