Ticket #38774: libstdc++_nanosleep.patch

File libstdc++_nanosleep.patch, 1.1 KB (added by howarth@…, 12 years ago)

backport of fix to support nanosleep in threads on c++11

  • libstdc++-v3/config/os/bsd/darwin/os_defines.h

    old new  
    4242// Static initializer macro is buggy in darwin, see libstdc++/51906
    4343#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
    4444
     45// Configure checks for nanosleep fail on Darwin, but nanosleep and
     46// sched_yield are always available, so use them.
     47#define _GLIBCXX_USE_NANOSLEEP 1
     48#define _GLIBCXX_USE_SCHED_YIELD 1
     49
    4550#endif
  • libstdc++-v3/acinclude.m4

    old new  
    11321132dnl --disable-libstdcxx-time
    11331133dnl        disables the checks completely
    11341134dnl
     1135dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX
     1136dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test
     1137dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in
     1138dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD.
     1139dnl
    11351140AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
    11361141
    11371142  AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])