《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
360 B

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