P0206R1: A joining thread -- Ville Voutilainen

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: P0206R1

Date: 2016-03-09

A joining thread

by Ville Voutilainen

Excerpt:

Changes from previous version

  • This paper revises P0206R0.
  • Removed the motivation elaboration, it can be found in the previous revision.
  • Removed the discarded solutions.
  • Added explanation for the std::thread-accessing functions and discarded alternatives for it.
  • Renamed safe_thread to joining_thread.
  • Used thread::id and thread::native_handle_type in joining_thread.
  • Updated proposed wording.

Abstract

C++ continues not to provide a thread type that would join() automatically on scope exit. This causes exception-safety problems, because failing to join() in all code paths causes the destructor of a std::thread to terminate(). This paper provides a solution that adds a new thread type that joins in its destructor, and is based on large-group and LEWG feedback given in Jacksonville. The proposal has been implemented and tested. 

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.