| Home | Libraries | People | FAQ | More

#### when_any, a dubious alternative

Certain topics in C++ can arouse strong passions, and exceptions are no exception. We cannot resist mentioning — for purely informational purposes — that when you need only the first result from some number of concurrently-running fibers, it would be possible to pass a `shared_ptr<`promise<>`>` to the participating fibers, then cause the initiating fiber to call `future::get()` on its `future<>`. The first fiber to call `promise::set_value()` on that shared `promise` will succeed; subsequent `set_value()` calls on the same `promise` instance will throw `future_error`.

Use this information at your own discretion. Beware the dark side.