Results of my master's thesis
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.

threadtest.py 310B

12345678910111213141516171819202122
  1. #!/usr/bin/python
  2. import thread, time
  3. def work():
  4. j = 0.0
  5. for i in xrange(10000000):
  6. j = j + j/2.0
  7. def child(tid):
  8. print "%d start" % tid
  9. work()
  10. print "%d stop" % tid
  11. def parent():
  12. i = 0
  13. while True:
  14. i += 1
  15. thread.start_new(child, (i,))
  16. if raw_input() == 'q': break
  17. parent()