title: What are the recommended ways to deal with multiprocessing and sleep?
body: <p>So, I've been playing with Python's <code>multiprocessing</code> module for a few days now, and there's something that I can't understand. Maybe someone can give me a bit of help.</p>
  
  <p>I'm trying to run two methods from the same class in parallel, but apparently there's something that I'm missing:</p>
  
  <pre><code>from multiprocessing import Process
  import time
  
  
  class SomeClass:
      def __init__(self):
          pass
  
      def meth1(self):
          print(1)
          time.sleep(10)
  
      def meth2(self):
          print(2)
          time.sleep(5 * 60)
  
  
  def main():
      while True:
          s = SomeClass()
  
          p1 = Process(target=s.meth1)  # I want this to run from 10 to 10 seconds
          p1.start()
          p2 = Process(target=s.meth2)  # I want this to run from 5 to 5 minutes
                                        # while the first one still does its own
                                        # job from 10s to 10s
          p2.start()
  
          p1.join()
          p2.join()
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>What I would expect to happen is:</p>
  
  <ul>
  <li>the first method should print <code>1</code>;</li>
  <li>then the second one should print <code>2</code> (without waiting 10s - which does happen and seems to work as expected);</li>
  <li>then I should see only 1s for the next 4 minutes and 50s (this isn't happening and the program just <em>waits</em> for that time to pass.</li>
  </ul>
  
  <p>What am I missing? Why does the second step work as expected, but the 3rd one doesn't? How can I make it work?</p>