Skip to content

Instantly share code, notes, and snippets.

@zhanglintc
Created May 16, 2020 09:08
Show Gist options
  • Save zhanglintc/2c284c2ec475095c34103e664f39aa46 to your computer and use it in GitHub Desktop.
Save zhanglintc/2c284c2ec475095c34103e664f39aa46 to your computer and use it in GitHub Desktop.
decorator make funciton thread runable
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