Section: 99 [futures.atomic_future] Status: Resolved Submitter: Alisdair Meredith Opened: 2010-01-23 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [futures.atomic_future].
View all issues with Resolved status.
The revised futures package in the current working paper simplified the is_ready/has_exception/has_value set of APIs, replacing them with a single 'valid' method. This method is used in many places to signal pre- and post- conditions, but that edit is not complete.
Atomic future retains the extended earlier API, and provides defined, synchronized behaviour for all calls. However, some preconditions and throws clauses are missing, which can easily be built around the new valid() api. Note that for consistency, I suggest is_ready/has_exception/has_value throw an exception if valid() is not true, rather than return false. I think this is implied by the existing pre-condition on is_ready.
[ 2010-01-23 See discussion starting with Message c++std-lib-26666. ]
2010 Pittsburgh: Moved to
NAD Editorial. Rationale added below.
Solved by N3058.
Insert the following extra paragraphs:
In 99 [futures.atomic_future]
bool is_ready() const;
Precondition: valid() == true.
18 Returns: true only if the associated state is ready.
bool has_exception() const;
19 Returns: true only if the associated state is ready and contains an exception.
bool has_value() const;
20 Returns: true only if the associated state is ready and contains a value.
void wait() const;
22 Effects: blocks until ...
template <class Rep, class Period> bool wait_for(const chrono::duration<Rep, Period>& rel_time) const;
23 Effects: blocks until ...
24 Returns: true only if ...
template <class Clock, class Duration> bool wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
25 Effects: blocks until ...
26 Returns: true only if ...