Files
Melter/Common/threading_decorators.py
2021-05-25 13:11:56 +01:00

15 lines
342 B
Python

#!/usr/bin/env python3
# *_* coding: utf-8 *_*
from threading import Thread
from functools import wraps
# Wrapper for running a function in a parallel thread
def run_in_thread(func):
@wraps(func)
def wrapper(*args, **kwargs):
thread = Thread(target=func, args=args, kwargs=kwargs)
thread.start()
return wrapper