Index: include/__threading_support =================================================================== --- include/__threading_support +++ include/__threading_support @@ -22,6 +22,8 @@ #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) #include #include +#include +#include #endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -156,6 +158,12 @@ } inline _LIBCPP_ALWAYS_INLINE +int __libcpp_thread_nanosleep(const timespec *req, timespec *rem) +{ + return nanosleep(req, rem); +} + +inline _LIBCPP_ALWAYS_INLINE int __libcpp_thread_join(__libcpp_thread_t* __t) { return pthread_join(*__t, 0); @@ -173,6 +181,12 @@ sched_yield(); } +inline _LIBCPP_ALWAYS_INLINE +void __libcpp_thread_terminate() +{ + std::terminate(); +} + // Thread local storage typedef pthread_key_t __libcpp_tl_key; Index: src/thread.cpp =================================================================== --- src/thread.cpp +++ src/thread.cpp @@ -40,7 +40,7 @@ thread::~thread() { if (__t_ != 0) - terminate(); + __libcpp_thread_terminate(); } void @@ -130,7 +130,7 @@ ts.tv_nsec = giga::num - 1; } - while (nanosleep(&ts, &ts) == -1 && errno == EINTR) + while (__libcpp_thread_nanosleep(&ts, &ts) == -1 && errno == EINTR) ; } }