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.

1097. #define __STDCPP_THREADS

Section: 17.2[support.types]Status:C++11Submitter: Jens MaurerOpened: 2009-04-03Last modified: 2016-01-28

Priority:Not Prioritized

View all otherissues in [support.types].

View all issues withC++11 status.

Discussion:

Addresses DE 18

Freestanding implementations do not (necessarily) have support for multiple threads (see 6.10.2[intro.multithread]). Applications and libraries may want to optimize for the absence of threads. I therefore propose a preprocessor macro to indicate whether multiple threads can occur.

There is ample prior implementation experience for this feature with various spellings of the macro name. For example, gcc implicitly defines_REENTRANT if multi-threading support is selected on the compiler command-line.

While this is submitted as a library issue, it may be more appropriate to add the macro in 16.8 cpp.predefined in the core language.

See alsoN2693.

[Batavia (2009-05):]

We agree with the issue, and believe it is properly a library issue.

We prefer that the macro be conditionally definedas part of the<thread> header.

Move to Review.

[2009-10 Santa Cruz:]

Move to Ready.

[2010-02-25 Pete moved to Open:]

The proposed resolution adds a feature-test macro named__STDCPP_THREADS, described after the following new text:

The standard library defines the following macros; no explicit prior inclusionof any header file is necessary.

The correct term here is "header", not "header file". But that's minor. The realproblem is that library entities are always defined in headers. If__STDCPP_THREADS is defined without including any header it's part ofthe language and belongs with the other predefined macros in the Preprocessorclause.

Oddly enough, the comments from Batavia say "We prefer that the macro beconditionally defined as part of the<thread> header." There's nomention of a decision to change this.

[2010-02-26 Ganesh updates wording.]

[2010 Pittsburgh: Adopt Ganesh's wording and move to Review.]

[2010-03-08 Pete adds:]

Most macros we have begin and end with with double underbars, this oneonly begins with double underbars.

[2010 Pittsburgh: Ganesh's wording adopted and moved to Ready for Pittsburgh.]

Proposed resolution:

Change 16.4.2.5[compliance]/3:

3 The supplied version of the header<cstdlib> shalldeclare at least the functionsabort(),atexit(), andexit() (18.5).The supplied version of the header<thread> either shall meet the same requirements as for ahosted implementation or including it shall have no effect. Theother headers listed in this table shall meet the same requirements asfor a hosted implementation.

Add the following line to table 15:

Table 15 — C++ headers for freestanding implementations
SubclauseHeader(s)
...
32.4[thread.threads] Threads<thread>

Add to the<thread> synopsis in 32.4[thread.threads]/1 the line:

namespace std {#define __STDCPP_THREADS __cplusplus  class thread;  ...

[8]ページ先頭

©2009-2026 Movatter.jp