Advertisement
zamotivator

Untitled

Feb 17th, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. ➜ cat test.py
  2. #!/usr/bin/env python2.7
  3.  
  4. import multiprocessing
  5. import time
  6. import sys
  7.  
  8. def task(index):
  9.     for i in range(0, 100):
  10.         sys.stdout.write('='.join([str(index)] * 10) + '\n')
  11.         time.sleep(0.001 * index)
  12.  
  13. if __name__ == '__main__':
  14.     pool = multiprocessing.Pool(8)
  15.     pool.map(task, range(0,100))
  16.     pool.close()
  17.     pool.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement