title: Python threading: can I sleep on two threading.Event()s simultaneously?
body: <p>If I have two <code>threading.Event()</code> objects, and wish to sleep until either one of them is set, is there an efficient way to do that in python?  Clearly I could do something with polling/timeouts, but I would like to really have the thread sleep until one is set, akin to how <code>select</code> is used for file descriptors.</p>
  
  <p>So in the following implementation, what would an efficient non-polling implementation of <code>wait_for_either</code> look like?</p>
  
  <pre><code>a = threading.Event()
  b = threading.Event()
  
  wait_for_either(a, b)
  </code></pre>