Created
May 16, 2020 09:08
-
-
Save zhanglintc/2c284c2ec475095c34103e664f39aa46 to your computer and use it in GitHub Desktop.
decorator make funciton thread runable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def thread_run(func): | |
import functools | |
import threading | |
@functools.wraps(func) | |
def wrapper(*args): | |
threading.Thread(target=func, args=(*args,), daemon=True).start() | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment