~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 17:57:15 UTC
  • mfrom: (4454 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617175715-p9ebpwx5rhc0qin1
Merge bzr.dev 4454 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
    LOCK_NB = LOCKFILE_FAIL_IMMEDIATELY
392
392
    _LockFileEx = ctypes.windll.kernel32.LockFileEx
393
393
    _UnlockFileEx = ctypes.windll.kernel32.UnlockFileEx
394
 
    _GetLastError = ctypes.windll.kernel32.GetLastError
395
394
 
396
395
    ### Define the OVERLAPPED structure.
397
396
    #   http://msdn2.microsoft.com/en-us/library/ms684342.aspx
440
439
                                 ctypes.byref(overlapped), # lpOverlapped
441
440
                                )
442
441
            if result == 0:
 
442
                last_err = ctypes.GetLastError()
443
443
                self._clear_f()
444
 
                last_err = _GetLastError()
445
444
                if last_err in (ERROR_LOCK_VIOLATION,):
446
445
                    raise errors.LockContention(filename)
447
446
                raise errors.LockContention(filename,
455
454
                                   0x00000000, # DWORD nNumberOfBytesToLockHigh
456
455
                                   ctypes.byref(overlapped), # lpOverlapped
457
456
                                  )
458
 
            self._clear_f()
459
457
            if result == 0:
 
458
                last_err = ctypes.GetLastError()
460
459
                self._clear_f()
461
 
                last_err = _GetLastError()
462
460
                raise errors.LockContention(self.filename,
463
461
                    'Unknown unlocking error: %s' % (last_err,))
 
462
            self._clear_f()
464
463
 
465
464
 
466
465
    class _ctypes_ReadLock(_ctypes_FileLock):