FS#27838 - Functions std::this_thread namespace doesn't provide, missing a option when use ./configure

Attached to Project: Arch Linux
Opened by Victor Hiairrassary (mecanix) - Thursday, 05 January 2012, 14:41 GMT
Last edited by Allan McRae (Allan) - Monday, 23 January 2012, 21:59 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description: Impossible to use functions in std::this_thread namespace, like sleep_for for example.
For this you must add --enable-libstdcxx-time=yes when configure gcc before compiling.

More informations on --enable-libstdcxx-time : http://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html



Additional info:
* package version(s) : all gcc that include thread c++0x support

Steps to reproduce:
Try to compile this :

#include<thread>

void f() {
std::this_thread::sleep_for(std::chrono::seconds(3));
}

int main() {
std::thread t(f);
t.join();
}
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 23 January 2012, 21:59 GMT
Reason for closing:  Implemented
Additional comments about closing:  gcc-4.6.2-6 in [testing]
Comment by Allan McRae (Allan) - Thursday, 05 January 2012, 21:29 GMT
Not sure if I will add this yet.... Workaround is to add -D_GLIBCXX_USE_NANOSLEEP to your compiler line.
Comment by Victor Hiairrassary (mecanix) - Thursday, 05 January 2012, 21:36 GMT
Why you don't want add it? It's a regular option no?

Now I use -D_GLIBCXX_USE_NANOSLEEP, but a program mustn't know it.. It's a implementation-define no, isn't it?
Comment by Victor Hiairrassary (mecanix) - Thursday, 05 January 2012, 21:51 GMT
A new exemple with --enable-libstdcxx-time, we can use std::this_tread::yield(), instead we must use -D_GLIBCXX_USE_SCHED_YIELD.

This is the same things for threads support : currently, there is --enable-threads=posix, otherwise we must use -D_GLIBCXX_HAS_GTHREADS and -D_GLIBCXX_USE_C99_STDINT_TR1

Loading...