Modify

Ticket #7575 (closed Feature Requests: fixed)

Opened 18 months ago

Last modified 17 months ago

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).

Attachments

Change History

comment:1 Changed 18 months ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

comment:2 Changed 18 months ago by viboes

  • Cc viboes added
  • Milestone To Be Determined deleted

comment:3 Changed 18 months ago by viboes

  • 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

comment:4 Changed 17 months ago by viboes

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

comment:5 Changed 17 months ago by viboes

Committed revision [81667].

comment:6 Changed 17 months ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.