Message ID | CAH6eHdSqnvavSavXzQZi7ix4+of4ZDzQW2L9pqkGZQ5fZH_W4w@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 11 October 2012 00:09, Jonathan Wakely wrote: > On 9 October 2012 18:49, Benjamin De Kosnik wrote: >> >>> I don't like the sched_yield macro being set there because it's >>> detected correctly by configure anyway, but I'm not going to labour >>> that point any more. >> >> Indeed. Then somebody will waste hours in the future wondering why >> configure says no but their TU says yes. >> >> At least a comment in the configure bits admitting defeat, people. > > Committed to trunk like so. Oops, that changelog entry missed out the PR number, so it hasn't updated Bugzilla, sorry. Jack, please test and check and unpatched GCC trunk now supports this_thread::yield() and this_thread::sleep_for(). Thanks for persevering to get it working.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 960bae3..c4cde86 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1158,6 +1158,11 @@ dnl --enable-libstdcxx-time=no dnl --disable-libstdcxx-time dnl disables the checks completely dnl +dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX +dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test +dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in +dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD. +dnl AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [ AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield]) diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h b/libstdc++-v3/config/os/bsd/darwin/os_defines.h index 421478d..be4aa14 100644 --- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h @@ -42,4 +42,9 @@ // Static initializer macro is buggy in darwin, see libstdc++/51906 #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC +// Configure checks for nanosleep fail on Darwin, but nanosleep and +// sched_yield are always available, so use them. +#define _GLIBCXX_USE_NANOSLEEP 1 +#define _GLIBCXX_USE_SCHED_YIELD 1 + #endif