mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 03:44:19 +00:00
15 lines
320 B
Python
15 lines
320 B
Python
|
from functools import wraps
|
||
|
from threading import Thread
|
||
|
|
||
|
|
||
|
def background(f):
|
||
|
'''
|
||
|
' This decorator executes a function in a Thread.
|
||
|
'''
|
||
|
@wraps(f)
|
||
|
def wrapped(*args, **kwargs):
|
||
|
thread = Thread(target=f, args=args, kwargs=kwargs)
|
||
|
thread.start()
|
||
|
return thread
|
||
|
return wrapped
|