Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.

1277.std::thread::id should be trivially copyable

Section: 32.4.3.2[thread.thread.id]Status:C++11Submitter: Anthony WilliamsOpened: 2009-11-24Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [thread.thread.id].

View all issues withC++11 status.

Discussion:

The class definition ofstd::thread::id inN3000is:

class thread::id {public:  id();};

Typically, I expect that the internal data members will either bepointers or integers, so that in practice the class will be triviallycopyable. However, I don't think the current wording guarantees it, andI think it would be useful. In particular, I can see a use forstd::atomic<std::thread::id> to allow athreadto claim ownership of a data structure atomicly, andstd::atomic<T> requires thatT is triviallycopyable.

[2010-02-12 Moved to Tentatively Ready after 7 positive votes on c++std-lib.]

Proposed resolution:

Add a new sentence to 32.4.3.2[thread.thread.id] p1:

1 An object of typethread::id provides a unique identifier foreach thread of execution and a single distinct value for allthread objects that do not represent a thread of execution(32.4.3[thread.thread.class]). Each thread of execution has anassociatedthread::id object that is not equal to thethread::id object of any other thread of execution and that isnot equal to thethread::id object of anystd::threadobject that does not represent threads of execution. The library mayreuse the value of athread::id of a terminated thread that canno longer be joined.thread::id shall be a triviallycopyable class (11[class]).


[8]ページ先頭

©2009-2026 Movatter.jp