title: How to register "atexit" function in python's multiprocessing subprocess?
body: <p>I have some subprocesses (using multiprocessing) and when they stop, each of them need do some final work. Something like the following, which did not work though...  </p>
  
  <pre><code>import multiprocessing
  import atexit
  
  def final():
      print "final work"
  
  def worker():
      print 'Doing some work'
      atexit.register(final)
  
  if __name__ == '__main__':
      p = multiprocessing.Process(target=worker)
      p.start()
      p.join()
  </code></pre>
  
  <p>So how could I do this?</p>