This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54847] --enable-libstdcxx-time=yes doesn't find the function nanosleep() on darwin
- From: "howarth at nitro dot med.uc.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Oct 2012 20:31:01 +0000
- Subject: [Bug libstdc++/54847] --enable-libstdcxx-time=yes doesn't find the function nanosleep() on darwin
- Auto-submitted: auto-generated
- References: <bug-54847-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54847
--- Comment #43 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-10-08 20:31:01 UTC ---
Both OpenBSD and FreeBSD seem to have nanosleep calls documented as...
The nanosleep() function conforms to IEEE Std 1003.1b-1993 (``POSIX'')
like Apple's. On the other hand, using a patch like...
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
will effectively default darwin to --enable-libstdcxx-time=yes and eliminates a
configure option.