This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] revised fix for nanosleep check in GLIBCXX_ENABLE_LIBSTDCXX_TIME for darwin
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: libstdc++ at gcc dot gnu dot org
- Cc: mikestump at comcast dot net, iain at codesourcery dot com, redi at gcc dot gnu dot org, paoauto-logoutoracle dot com at bromo dot med dot uc dot edu, gcc-patches at gcc dot gnu dot org
- Date: Mon, 8 Oct 2012 20:39:21 -0400
- Subject: [PATCH] revised fix for nanosleep check in GLIBCXX_ENABLE_LIBSTDCXX_TIME for darwin
The --enable-libstdcxx-time=yes configure option fails to validate the
presence of a usable nanosleep() call on darwin due to its use of pre-2008
POSIX timers. As both nanosleep() and sched_yield() have always been available
on darwin, the attached patch simply defines _GLIBCXX_USE_NANOSLEEP and
_GLIBCXX_USE_SCHED_YIELD in config/os/bsd/darwin/os_defines.h. This also has
the advantage of effectively making --enable-libstdcxx-time=yes the default
on darwin. Regression tested on x86_64-apple-darwin12.
Okay for gcc trunk as well as gcc-4_7-branch/gcc-4_6-branch/gcc-4_5-branch?
Jack
libstdc++-v3/
2012-10-08 Jack Howarth <howarth@bromo.med.uc.edu>
PR libstdc++/54847
* config/os/bsd/darwin/os_defines.h (_GLIBCXX_USE_NANOSLEEP): Define.
(_GLIBCXX_USE_SCHED_YIELD): Likewise.
Index: libstdc++-v3/config/os/bsd/darwin/os_defines.h
===================================================================
--- libstdc++-v3/config/os/bsd/darwin/os_defines.h (revision 192222)
+++ libstdc++-v3/config/os/bsd/darwin/os_defines.h (working copy)
@@ -42,4 +42,9 @@
// Static initializer macro is buggy in darwin, see libstdc++/51906
#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
+// Use nanosleep and sched_yield in libc for time.clock and
+// thread.thread.this in C++11 standard.
+#define _GLIBCXX_USE_NANOSLEEP 1
+#define _GLIBCXX_USE_SCHED_YIELD 1
+
#endif