Advertisement
here2share

# loose_thread.py

Dec 29th, 2014
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. # loose_thread.py <<< missing ~ ''.join.allthreads >>> Note: It will even insert the results within results or append
  2. ###ZZZ Could this also be able to multi-buffer images? Can't find the solution anywhere
  3.  
  4. from sys    import stdout
  5. from time   import sleep
  6. from random import randint
  7. from thread import start_new_thread
  8. import e32
  9.  
  10. def worker(name):
  11.   wait=randint(2,7)
  12.   sleep(wait)
  13.   print "I'm",name,"and waited",wait,"seconds."
  14.   stdout.flush()
  15.  
  16. start_new_thread(worker,("thread 1",))
  17. start_new_thread(worker,("thread 2",))
  18. start_new_thread(worker,("thread 3",))
  19. start_new_thread(worker,("thread 4",))
  20. start_new_thread(worker,("thread 5",))
  21. start_new_thread(worker,("thread 6",))
  22. start_new_thread(worker,("thread 7",))
  23. start_new_thread(worker,("thread 8",))
  24. start_new_thread(worker,("thread 9",))
  25.  
  26. while True:
  27.   pass # To be False based on what reason though? I might never know
  28.   e32.ao_yield()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement