Ticket #7575 (closed Feature Requests: fixed)
c++11 compliance: A future created by async should "join" in the destructor
|Reported by:||Andrzej Krzemienski <akrzemi1@…>||Owned by:||viboes|
|Keywords:||async future block||Cc:||viboes|
The C++ Standard requires (Section 3.6.8, Paragraph 5) in cases where std::async() creates a future and no explicit waiting function is called for the future, that "the associated thread completion synchronizes with [...] with the return from the last function that releases the shared state [...]".
This effectively means that destructor of such future must wait until the associated thread finishes. This requirement makes std::async() a tool that behaves like RAII classes: it binds the resource (the associated thread) with the life-time of the future object.
Boost.Thread should follow the same behavior for futures created with async (when called with parameter launch::async).
- Owner changed from anthonyw to viboes
- Status changed from new to assigned
- Summary changed from A future created by async should "join" in the destructor to c++11 compliance: A future created by async should "join" in the destructor
- Milestone set to Boost 1.53.0