title: Blocking on many locks/futures/etc. until any is ready
body: <p>Is it possible to block on a group of locks/futures/any blockable entities, until any one of them is ready? The idea is that we can do:</p>
  
  <pre><code>std::vector&lt;std::future&lt;T&gt;&gt; futures = ...;
  auto ready_future = wait_until_an_element_is_ready(futures);
  process(ready_future.get());
  </code></pre>
  
  <p>I remember libraries like libevent, libev, and libuv have this kind of ability for IO tasks. But I don't know if these can be done for locks/futures.</p>
  
  <p>A way I thought of to sort of achieve this is to have the futures call a handler upon completion, but at the same time compare-and-exchange the handler to null so that no other futures can call it. This requires the coordination of the futures, however, so can't be done for locks.</p>
  
  <p><strong>UPDATE:</strong> There seems to be a <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4107.html#future">proposal</a> for it for C++2x.</p>