~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 00:05:14 UTC
  • mfrom: (1861 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: john@arbash-meinel.com-20060713000514-aa62627aa0d4deb6
[merge] bzr.dev 1861

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from bzrlib.trace import mutter
42
42
from bzrlib.errors import LockError
43
43
 
 
44
 
44
45
class _base_Lock(object):
45
46
    def _open(self, filename, filemode):
46
47
        try:
65
66
    def unlock(self):
66
67
        raise NotImplementedError()
67
68
 
68
 
        
69
 
 
70
 
 
71
 
 
72
69
 
73
70
############################################################
74
71
# msvcrt locks
144
141
                    raise LockError(e)
145
142
 
146
143
 
147
 
 
148
144
        class _w32c_ReadLock(_w32c_FileLock):
149
145
            def __init__(self, filename):
150
146
                _w32c_FileLock._lock(self, filename, 'rb',
156
152
                                     LOCK_EX + LOCK_NB)
157
153
 
158
154
 
159
 
 
160
155
        WriteLock = _w32c_WriteLock
161
156
        ReadLock = _w32c_ReadLock
162
157
 
191
186
                    _msvc_lock(self._open(filename, 'wb'), self.LOCK_EX)
192
187
 
193
188
 
194
 
 
195
189
            def _msvc_lock(f, flags):
196
190
                try:
197
191
                    # Unfortunately, msvcrt.LK_RLCK is equivalent to msvcrt.LK_LOCK
247
241
                    raise LockError(e)
248
242
 
249
243
 
250
 
 
251
244
            WriteLock = _msvc_WriteLock
252
245
            ReadLock = _msvc_ReadLock
253
246
        except ImportError: