Opened 10 years ago
Closed 10 years ago
#7575 closed Feature Requests (fixed)
c++11 compliance: A future created by async should "join" in the destructor
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.53.0 | Component: | thread |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | async future block | Cc: | viboes |
Description
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).
Change History (6)
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Cc: | added |
---|---|
Milestone: | To Be Determined |
comment:3 by , 10 years ago
Milestone: | → Boost 1.53.0 |
---|---|
Summary: | A future created by async should "join" in the destructor → c++11 compliance: A future created by async should "join" in the destructor |
comment:4 by , 10 years ago
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Committed in trunk revision [81410]. (c++11 version)