Revision 03c5291c lib/locking.py

b/lib/locking.py
47 47

  
48 48
_DEFAULT_PRIORITY = 0
49 49

  
50
#: Minimum timeout required to consider scheduling a pending acquisition
51
#: (seconds)
52
_LOCK_ACQUIRE_MIN_TIMEOUT = (1.0 / 1000)
53

  
50 54

  
51 55
def ssynchronized(mylock, shared=0):
52 56
  """Shared Synchronization decorator.
......
662 666
      self.__do_acquire(shared)
663 667
      return True
664 668

  
669
    # The lock couldn't be acquired right away, so if a timeout is given and is
670
    # considered too short, return right away as scheduling a pending
671
    # acquisition is quite expensive
672
    if timeout is not None and timeout < _LOCK_ACQUIRE_MIN_TIMEOUT:
673
      return False
674

  
665 675
    prioqueue = self.__pending_by_prio.get(priority, None)
666 676

  
667 677
    if shared:

Also available in: Unified diff