Title
#define __STDCPP_THREADS
Status
c++11
Section
[support.types]
Submitter
Jens Maurer

Created on 2009-04-03.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [compliance]/3:

3 The supplied version of the header <cstdlib> shall declare at least the functions abort(), atexit(), and exit() (18.5). The supplied version of the header <thread> either shall meet the same requirements as for a hosted implementation or including it shall have no effect. The other headers listed in this table shall meet the same requirements as for a hosted implementation.

Add the following line to table 15:

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

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

namespace std {

#define __STDCPP_THREADS __cplusplus

  class thread;
  ...
Date: 2010-10-21.18:28:33

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

Date: 2010-03-08.00:00:00

[ 2010-03-08 Pete adds: ]

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

Date: 2010-10-21.18:28:33

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

Date: 2010-02-26.00:00:00

[ 2010-02-26 Ganesh updates wording. ]

Date: 2010-02-25.00:00:00

[ 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 inclusion of any header file is necessary.

The correct term here is "header", not "header file". But that's minor. The real problem is that library entities are always defined in headers. If __STDCPP_THREADS is defined without including any header it's part of the language and belongs with the other predefined macros in the Preprocessor clause.

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

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Move to Ready.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

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

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

Move to Review.

Date: 2015-09-21.14:54:12

Addresses DE 18

Freestanding implementations do not (necessarily) have support for multiple threads (see [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 also N2693.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg709
2010-10-21 18:28:33adminsetmessages: + msg708
2010-10-21 18:28:33adminsetmessages: + msg707
2010-10-21 18:28:33adminsetmessages: + msg706
2010-10-21 18:28:33adminsetmessages: + msg705
2010-10-21 18:28:33adminsetmessages: + msg704
2010-10-21 18:28:33adminsetmessages: + msg703
2010-10-21 18:28:33adminsetmessages: + msg702
2009-04-03 00:00:00admincreate