title: Python threading.Event reset?
body: <p>I have a function that I want to run repeatedly on <code>threading.Event</code>s. However it looks like you can only use each <code>Event</code> instance a single time.</p>
  
  <p>Is there a way to reset the <code>thread.Event</code> so that it can be triggered again? I imagine it could look something like this:</p>
  
  <pre><code>import threading
  import time
  
  
  def waiting_function(trigger):
      while True:
          trigger.wait()
          # do stuff after trigger
          trigger.reset()
  
  trigger = threading.Event()
  
  waiting_thread = threading.Thread(target=waiting_function, args=[trigger])
  waiting_thread.start()
  
  time.sleep(3.)  # do some stuff that takes a while
  trigger.set()
  time.sleep(3.)  # do some stuff that takes a while
  if not trigger.is_set:
      trigger.set()
  </code></pre>
  
  <p>Alternatively, do I have to create a new <code>trigger</code> after each set and share it between the threads?</p>