Title
packaged_task::operator() synchronization too broad?
Status
c++14
Section
[futures.task.members]
Submitter
Pete Becker

Created on 2012-03-12.00:00:00 last changed 123 months ago

Messages

Date: 2013-10-08.22:03:22

Proposed resolution:

This wording is relative to N3691.

  1. Remove [futures.task.members] p18 as indicated:

    void operator()(ArgTypes... args);
    

    […]

    -18- Synchronization: a successful call to operator() synchronizes with (1.10) a call to any member function of a future or shared_future object that shares the shared state of *this. The completion of the invocation of the stored task and the storage of the result (whether normal or exceptional) into the shared state synchronizes with (1.10) the successful return from any member function that detects that the state is set to ready. [Note: operator() synchronizes and serializes with other functions through the shared state. — end note]

Date: 2013-10-08.22:03:22

[ 2013-09, Chicago: move to Ready ]

Anthony's conclusion is that the offending paragraph is not needed. Already included in the statement that the state is made ready.

Recommendation: Remove [futures.task.members] p18 (the synchronization clause). Redundant because of [futures.state] p9.

Moved to Ready

Date: 2012-11-02.22:48:46

[ 2012, Portland: move to Open ]

If it said "a successful return from" (or "a return from" to cover exceptions) the problem would be more obvious.

Detlef: will ask Anthony Williams to draft some wording.

Moved to open (Anthony drafted to draft)

Date: 2012-03-12.00:00:00

According to [futures.task.members] p.18:

[A] successful call to [packaged_task::]operator() synchronizes with a call to any member function of a future or shared_future object that shares the shared state of *this.

This requires that the call to operator() synchronizes with calls to future::wait_for, future::wait_until, shared_future::wait_for, and shared_future::wait_until, even when these functions return because of a timeout.

History
Date User Action Args
2014-02-27 17:03:20adminsetstatus: wp -> c++14
2014-02-20 13:52:38adminsetstatus: voting -> wp
2014-02-12 14:19:44adminsetstatus: ready -> voting
2013-10-08 22:03:22adminsetmessages: + msg6688
2013-10-08 22:03:22adminsetmessages: + msg6687
2013-10-08 22:03:22adminsetstatus: open -> ready
2012-11-02 22:48:46adminsetmessages: + msg6251
2012-11-02 22:48:46adminsetstatus: new -> open
2012-03-12 00:00:00admincreate