def during(f):
def decorator(g):<EOL><INDENT>@wraps(g)<EOL>def h(*args, **kargs):<EOL><INDENT>tf = Thread(target=f, args=args, kwargs=kargs)<EOL>tf.start()<EOL>r = g(*args, **kargs)<EOL>tf.join()<EOL>return r<EOL><DEDENT>return h<EOL><DEDENT>return decorator<EOL>
Runs f during the decorated function's execution in a separate thread.