I have multiple threads ruing. I want them to start with delay timer of 5 seconds. For ex: Thread1 starts with t seconds, Thread2 starts with t+5 seconds, Tread3 starts with t+10 seconds and so on. How can I do this, by changing the code below ...
from threading import Thread
import time
def Device(i):
print "Thread%d starts in %d" %(i, time.time())
# Thread1 needs to start with t seconds
# Thread2 needs to start with t+5 seconds
# Thread3 needs to start with t+10 seconds
.......
for i in range(100):
t = Thread(target=Device, args=(i,))
t.start()
برچسب:
نویسنده: استخدام کار