~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/counted_lock.py

  • Committer: Patch Queue Manager
  • Date: 2014-02-12 18:22:22 UTC
  • mfrom: (6589.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20140212182222-beouo25gaf1cny76
(vila) The XDG Base Directory Specification uses the XDG_CACHE_HOME,
 not XDG_CACHE_DIR. (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Counted lock class"""
18
18
 
 
19
from __future__ import absolute_import
19
20
 
20
21
from bzrlib import (
21
22
    errors,
46
47
        self._lock_mode = None
47
48
        self._lock_count = 0
48
49
 
 
50
    def get_physical_lock_status(self):
 
51
        """Return physical lock status.
 
52
 
 
53
        Returns true if a lock is held on the transport. If no lock is held, or
 
54
        the underlying locking mechanism does not support querying lock
 
55
        status, false is returned.
 
56
        """
 
57
        try:
 
58
            return self._real_lock.peek() is not None
 
59
        except NotImplementedError:
 
60
            return False
 
61
 
49
62
    def is_locked(self):
50
63
        return self._lock_mode is not None
51
64