5 threads, each sleeps 3 second in parallel : Thread Sleep : Thread PYTHON examples


PYTHON examples » Thread » Thread Sleep »

 

5 threads, each sleeps 3 second in parallel


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 Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Thread
» Thread Sleep