Package commons :: Module threads :: Class SynchronizedObject
[hide private]
[frames] | no frames]

Class SynchronizedObject

source code

         object --+    
                  |    
decs.GenericWrapper --+
                      |
                     SynchronizedObject

Wrap an object and all of its methods with synchronization.

Example:

   class SynchronizedObject(GenericWrapper):
       ''' wrap an object and all of its methods with synchronization '''
       def _ _init_ _(self, obj, ignore=( ), lock=None):
           if lock is None:
               import threading
               lock = threading.RLock( )
           GenericWrapper._ _init_ _(self, obj, lock.acquire, lock.release, ignore)

From the Python Cookbook.


Copyright: O'Reilly Media

Instance Methods [hide private]
 
__init__(self, obj, ignore=(), lock=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code

Inherited from decs.GenericWrapper: __getattr__, __setattr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, obj, ignore=(), lock=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)