def synchronized(func):
func.__lock__ = threading.Lock()<EOL>def synced_func(*args, **kargs):<EOL><INDENT>with func.__lock__:<EOL><INDENT>return func(*args, **kargs)<EOL><DEDENT><DEDENT>return synced_func<EOL>
Decorator to synchronize function.