From 39bd5215113e4171f9650fe01b562386024efd4d Mon Sep 17 00:00:00 2001 From: Faraphel Date: Mon, 18 Jul 2022 19:51:20 +0200 Subject: [PATCH] threaded decorator now return the thread --- source/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/__init__.py b/source/__init__.py index 606939f..edcea6a 100644 --- a/source/__init__.py +++ b/source/__init__.py @@ -27,7 +27,9 @@ def threaded(func: Callable) -> Callable: def wrapper(*args, **kwargs): # run the function in a Daemon, so it will stop when the main thread stops - Thread(target=func, args=args, kwargs=kwargs, daemon=True).start() + thread = Thread(target=func, args=args, kwargs=kwargs, daemon=True) + thread.start() + return thread return wrapper