Advertisement
rfmonk

multiprocessing_subclass.py

Feb 8th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # this is from The Python
  4. # Standard Library by example
  5. # ISBN13: 9780321767349
  6.  
  7. import multiprocessing
  8.  
  9.  
  10. class Worker(multiprocessing.Process):
  11.  
  12.     def run(self):
  13.         print 'In %s' % self.name
  14.         return
  15.  
  16.  
  17. if __name__ == '__main__':
  18.     jobs = []
  19.     for i in range(5):
  20.         p = Worker()
  21.         jobs.append(p)
  22.         p.start()
  23.     for j in jobs:
  24.         j.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement