5 threads, each sleeps 3 second in parallel
import thread, time
def counter(myId, count):
for i in range(count):
time.sleep(1)
print 'thread number %d reporting in at %d...' % (myId, time.clock())
print time.clock()
for i in range(5):
thread.start_new(counter, (i, 3))
time.sleep(5)
print 'Main thread exiting.'
Related examples in the same category