NamedAtomicLock (version 1.1.1)
index

Copyright (c) 2016 Timothy Savannah All Rights Reserved under terms of LGPLv3.
You should have received a copy of this as LICENSE with the source distribution, or it is always available at
http://www.gnu.org/licenses/lgpl-3.0.en.html
 
See https://github.com/kata198/NamedAtomicLock for latest version
 
NamedAtomicLock - A Named atomic lock local to the machine

 
Package Contents
       

 
Classes
       
builtins.object
NamedAtomicLock

 
class NamedAtomicLock(builtins.object)
     Methods defined here:
__init__(self, name, lockDir=None, maxLockAge=None)
NamedAtomicLock - Create a NamedAtomicLock.
    This uses a named directory, which is defined by POSIX as an atomic operation.
 
@param name <str> - The lock name, Cannot contain directory seperator (like '/')
@param lockDir <None/str> - Directory in which to store locks. Defaults to tempdir
@param maxLockAge <None/float> - Maximum number of seconds lock can be held before it is considered "too old" and fair game to be taken.
    You should likely define this as a reasonable number, maybe 4x as long as you think the operation will take, so that the lock doesn't get
    held by a dead process.
acquire(self, timeout=None)
acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout.
  Returns "True" if you got the lock, otherwise "False"
 
@param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquire it.
 
@return  <bool> - True if you got the lock, otherwise False.
release(self, forceRelease=False)
release - Release the lock.
 
@param forceRelease <bool> - If True, will release the lock even if we don't hold it.
 
@return - True if lock is released, otherwise False

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
hasLock
hasLock - Property, returns True if we have the lock, or False if we do not.
 
@return <bool> - True/False if we have the lock or not.
isHeld
isHeld - True if anyone holds the lock, otherwise False.
 
@return bool - If lock is held by anyone

 
Data
        __all__ = ('NamedAtomicLock',)
__version_tuple__ = (1, 1, 1)