title: Multiprocessing Event not Working
body: <p>I have written the following code in Python 3 using the multiprocessing module. It's more of a test script to see how to use <code>Event</code>. However, it's not working.</p>
  
  <pre><code>import multiprocessing, time
  
  from multiprocessing import Process, Event
  
  event = Event()
  
  def f(n):
  
      if n == 1:
  
          print("starting")
  
          event.wait()
  
          print("Done!")
  
  
      if n == 2:
  
          time.sleep(3)
  
          event.set()
  
          print("setting")
  
  if __name__ == "__main__":
  
      p1 = Process(target = f, args = (1,))
      p2 = Process(target = f, args = (2,))
  
      p1.start()
  
      p2.start()
  
      time.sleep(1000)
  </code></pre>
  
  <p>However, when I run this I only get the output:</p>
  
  <pre><code>starting
  setting
  </code></pre>
  
  <p>I want to get the output:</p>
  
  <pre><code>starting
  setting
  Done!
  </code></pre>
  
  <p>But for some reason the <code>p1</code> Process is not moving on with its code after event.set() has been called by the <code>p2</code> process.</p>
  
  <p>Any ideas why this is happening?</p>