Package emma :: Module complement
[hide private]
[frames] | no frames]

Module complement

source code

The necessary class and decorators for interface and module

Copyright: (c) 2011 hackmeeting

Author: Ruben Pollan

Organization: hackmeeting


License: This program is free software; you can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details.

Classes [hide private]
Empty class mented to be inhered by interface and module
Functions [hide private]
Decorator that adds a lock to a method
source code
Function Details [hide private]


source code 

Decorator that adds a lock to a method

It decorates methods of child classes of Complement, usually interface or module. Adds the use of a locker (mutex) to the method, so the access to the class data is thread safe.

>>> from emma.complement import use_lock
>>> class myModule(Module):
...     @use_lock
...     def run(self):
...         self.var = 0
...     @use_lock
...     def inc(self):
...         self.var += 1