os_kernel_lab/related_info/lab7/semaphore_condition/thr-ex2.py

17 lines
360 B
Python

#!/usr/bin/env python
import threading
import time
count=1
class KissThread(threading.Thread):
def run(self):
global count
print "Thread # %s:Pretending to do stuff" % count
count+=1
time.sleep(2)
print "done with stuff"
for t in range(5):
KissThread().start()