Modify

Opened 5 years ago

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

Attachments (0)

Change History (6)

comment:1 Changed 5 years ago by viboes

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

comment:2 Changed 5 years ago by viboes

  • Cc viboes added
  • Milestone To Be Determined deleted

comment:3 Changed 5 years ago by viboes

  • Milestone set to Boost 1.53.0
  • 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

comment:4 Changed 5 years ago by viboes

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

comment:5 Changed 5 years ago by viboes

Committed revision [81667].

comment:6 Changed 5 years ago by viboes

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
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.