This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

### 1106. Multiple exceptions from connected `shared_future::get()`?

Section: 33.10.8 [futures.shared.future] Status: Resolved Submitter: Thomas J. Gritzan Opened: 2009-04-03 Last modified: 2021-06-06

Priority: Not Prioritized

View all other issues in [futures.shared.future].

View all issues with Resolved status.

Discussion:

It is not clear, if multiple threads are waiting in a `shared_future::get()` call, if each will rethrow the stored exception.

Paragraph 9 reads:

> Throws: the stored exception, if an exception was stored and not retrieved before.

The "not retrieved before" suggests that only one exception is thrown, but one exception for each call to `get()` is needed, and multiple calls to `get()` even on the same `shared_future` object seem to be allowed.

I suggest removing "and not retrieved before" from the Throws paragraph. I recommend adding a note that explains that multiple calls on `get()` are allowed, and each call would result in an exception if an exception was stored.

[ Batavia (2009-05): ]

> We note there is a pending paper by Detlef on such `future`-related issues; we would like to wait for his paper before proceeding.

> Alisdair suggests we may want language to clarify that this `get()` function can be called from several threads with no need for explicit locking.

> Move to Open.

[ 2010-01-23 Moved to Tentatively NAD Editorial after 5 positive votes on c++std-lib. ]

Rationale:

Resolved by paper N2997.

Proposed resolution:

Change [futures.shared_future]:

>     const R& shared_future::get() const;
>     R& shared_future<R&>::get() const;
>     void shared_future<void>::get() const;

> > ...

> > -9- Throws: the stored exception, if an exception was stored and not retrieved before. [Note: Multiple calls on `get()` are allowed, and each call would result in an exception if an exception was stored. — end note]