Index: libcxx/trunk/include/__threading_support =================================================================== --- libcxx/trunk/include/__threading_support +++ libcxx/trunk/include/__threading_support @@ -61,6 +61,8 @@ typedef pthread_t __libcpp_thread_id; // Thread +#define _LIBCPP_NULL_THREAD 0U + typedef pthread_t __libcpp_thread_t; // Thrad Local Storage @@ -86,6 +88,8 @@ typedef DWORD __libcpp_thread_id; // Thread +#define _LIBCPP_NULL_THREAD 0U + typedef HANDLE __libcpp_thread_t; // Thread Local Storage @@ -158,6 +162,9 @@ // Thread _LIBCPP_THREAD_ABI_VISIBILITY +bool __libcpp_thread_isnull(const __libcpp_thread_t *__t); + +_LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), void *__arg); @@ -309,6 +316,10 @@ } // Thread +bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) { + return *__t == 0; +} + int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), void *__arg) { @@ -506,6 +517,10 @@ return static_cast(reinterpret_cast(__func(__arg))); } +bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) { + return *__t == 0; +} + int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), void *__arg) { Index: libcxx/trunk/include/thread =================================================================== --- libcxx/trunk/include/thread +++ libcxx/trunk/include/thread @@ -290,7 +290,7 @@ typedef __libcpp_thread_t native_handle_type; _LIBCPP_INLINE_VISIBILITY - thread() _NOEXCEPT : __t_(0) {} + thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} #ifndef _LIBCPP_HAS_NO_VARIADICS template