Title
timed waiting functions cannot timeout if launch::async policy used
Status
c++14
Section
[futures.async]
Submitter
Jonathan Wakely

Created on 2011-11-14.00:00:00 last changed 123 months ago

Messages

Date: 2013-09-29.20:56:14

[ This wording is relative to the FDIS. ]

Change [futures.async] p5 as indicated:

If the implementation chooses the launch::async policy,

  • a call to a waiting function on an asynchronous return object that shares the shared state created by this async call shall block until the associated thread has completed, as if joined, or else time out ([thread.thread.member]);
Date: 2013-09-29.20:56:14

[ 2013-09, Chicago ]

Discussion of interaction with the absence of a Posix timed join.

Jonathan Wakely withdrew his objection, so moved to Immediate.

Accept for Working Paper

Date: 2013-09-29.20:56:14

[ 2013, Bristol ]

"Non-timed" made the new wording redundant and the result overly weak. Remove it.

Attempted to move to add this to the working paper (Concurrency motion 2) without the addition of "non-timed". Motion was withdrawn after Jonathan Wakely expressed implementability concerns.

Date: 2012-11-03.13:22:20

[ 2012, Portland: move to Review ]

Detlef: Do we actually need this fix — is it detectable?

Yes — you will never get a timeout. Should we strike the whole paragraph?

Hans: issue with thread local destruction.

Niklas: I have a strong expectation that a timed wait will respect the timeout

agreed

Detlef: we want a timed wait that does not time out to return like a non-timed wait; but is this implementable?

Pablo: Could we simply append ", or else time out"

Detlef: the time out on the shared state needs implementing anyway, even if the underlying O/S does not support a timed join.

Hans: the net effect is the timeout does not cover the thread local destruction... ah, I see what you're doing

Detlef: happy with Pablo's proposal

Wording proposed is to append after the word "joined" add ", or else time out"

Moved to review with this wording.

Date: 2011-11-14.00:00:00

[futures.async] p5 says

If the implementation chooses the launch::async policy,

  • a call to a waiting function on an asynchronous return object that shares the shared state created by this async call shall block until the associated thread has completed, as if joined ([thread.thread.member]);

That should say a non-timed waiting function, otherwise, calling a timed waiting function can block indefinitely waiting for the associated thread to complete, rather than timing out after the specified time.

Since std::thread does not provide a timed_join() function (nor does Pthreads, making it impossible on many platforms) there is no way for a timed waiting function to try to join but return early due to timeout, therefore timed waiting functions either cannot guarantee to timeout or cannot be used to meet the requirement to block until the thread is joined. In order to allow timed waiting functions to timeout the requirement should only apply to non-timed waiting functions.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-09-29 20:56:14adminsetmessages: + msg6669
2013-09-29 16:53:12adminsetstatus: review -> wp
2013-09-25 18:17:27adminsetmessages: + msg6614
2012-11-02 22:48:46adminsetmessages: + msg6239
2012-11-02 22:48:46adminsetstatus: new -> review
2011-11-28 22:32:04adminsetmessages: + msg5931
2011-11-14 00:00:00admincreate