Module cfg :: Class lock_list
[hide private]
[frames] | no frames]

Class lock_list

source code


Class target for easy multithreading access to variables (in list).

You create instance of this class and can from any thread easy access to you variables by index (as in dictionary). Example:

   LOCK = lock_list(10)
   LOCK[3] = False
   val = LOCK[3]

All get, set and del for index key will be auto locked.


Note: Safe for multithreading.

Instance Methods [hide private]
 
__init__(self, length)
Initialize instance.
source code
 
__getitem__(self, key)
Return value for index.
source code
 
__setitem__(self, key, val)
Set value for index.
source code
 
__delitem__(self, key)
Delete index key.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, length)
(Constructor)

source code 

Initialize instance.

Overrides: object.__init__

__getitem__(self, key)
(Indexing operator)

source code 

Return value for index. If no such key then raise IndexError.

__delitem__(self, key)
(Index deletion operator)

source code 

Delete index key. If no such key then raise IndexError.

Raises:
  • IndexError - Index error.