nopaque/daemon/decorators.py

15 lines
320 B
Python
Raw Normal View History

2020-06-05 12:42:04 +00:00
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
2020-06-05 13:19:01 +00:00
return wrapped