Created
December 6, 2016 06:26
-
-
Save nom3ad/c80a2c2f9dee6bfaf3b8f691696405e2 to your computer and use it in GitHub Desktop.
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
import threading | |
def spawnthread(f): | |
def func(*args,**kwargs): | |
thr = threading.Thread(target=f, args=args, kwargs=kwargs) | |
thr.start() | |
return func | |
# -------------------------- | |
import time | |
@spawnthread | |
def x(a): | |
print 'start',a | |
time.sleep(5) | |
print 'end',a | |
x(10);x(20);x(30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment