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: Andrzej Krzemienski <akrzemi1@…> 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 viboes, 10 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:2 by viboes, 10 years ago

Cc: viboes added
Milestone: To Be Determined

comment:3 by viboes, 10 years ago

Milestone: Boost 1.53.0
Summary: A future created by async should "join" in the destructorc++11 compliance: A future created by async should "join" in the destructor

comment:4 by viboes, 10 years ago

Committed in trunk revision [81410]. (c++11 version)

comment:5 by viboes, 10 years ago

Committed revision [81667].

comment:6 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.