Public Member Functions | Public Attributes | Static Public Attributes
rocon_python_redis.client.Lock Class Reference

List of all members.

Public Member Functions

def __enter__
def __exit__
def __init__
def acquire
def release

Public Attributes

 acquired_until
 name
 redis
 sleep
 timeout

Static Public Attributes

tuple LOCK_FOREVER = float(2 ** 31 + 1)

Detailed Description

A shared, distributed Lock. Using Redis for locking allows the Lock
to be shared across processes and/or machines.

It's left to the user to resolve deadlock issues and make sure
multiple clients play nicely together.

Definition at line 1786 of file client.py.


Constructor & Destructor Documentation

def rocon_python_redis.client.Lock.__init__ (   self,
  redis,
  name,
  timeout = None,
  sleep = 0.1 
)
Create a new Lock instnace named ``name`` using the Redis client
supplied by ``redis``.

``timeout`` indicates a maximum life for the lock.
By default, it will remain locked until release() is called.

``sleep`` indicates the amount of time to sleep per loop iteration
when the lock is in blocking mode and another client is currently
holding the lock.

Note: If using ``timeout``, you should make sure all the hosts
that are running clients have their time synchronized with a network
time service like ntp.

Definition at line 1797 of file client.py.


Member Function Documentation

Definition at line 1821 of file client.py.

def rocon_python_redis.client.Lock.__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)

Definition at line 1824 of file client.py.

def rocon_python_redis.client.Lock.acquire (   self,
  blocking = True 
)
Use Redis to hold a shared, distributed lock named ``name``.
Returns True once the lock is acquired.

If ``blocking`` is False, always return immediately. If the lock
was acquired, return True, otherwise return False.

Definition at line 1827 of file client.py.

Definition at line 1861 of file client.py.


Member Data Documentation

Definition at line 1811 of file client.py.

tuple rocon_python_redis::client.Lock::LOCK_FOREVER = float(2 ** 31 + 1) [static]

Definition at line 1795 of file client.py.

Definition at line 1811 of file client.py.

Definition at line 1811 of file client.py.

Definition at line 1811 of file client.py.

Definition at line 1811 of file client.py.


The documentation for this class was generated from the following file:


rocon_python_redis
Author(s): Andy McCurdy
autogenerated on Fri May 2 2014 10:35:49