Fix availability of __thread_id on builds with external threading. Reviewed as https://reviews.llvm.org/D66480

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2019-08-20 16:16:23 +00:00
parent 8ed9ff748f
commit e746afcf01

View File

@ -23,16 +23,11 @@
# include <__external_threading>
#elif !defined(_LIBCPP_HAS_NO_THREADS)
typedef ::timespec __libcpp_timespec_t;
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
# include <pthread.h>
# include <sched.h>
#endif
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
defined(_LIBCPP_HAS_THREAD_API_WIN32)
@ -47,8 +42,16 @@ _LIBCPP_PUSH_MACROS
#define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
#endif
typedef ::timespec __libcpp_timespec_t;
#endif // !defined(_LIBCPP_HAS_NO_THREADS)
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_THREADS)
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Mutex
typedef pthread_mutex_t __libcpp_mutex_t;
@ -109,7 +112,7 @@ typedef void* __libcpp_thread_t;
typedef long __libcpp_tls_key;
#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
#endif
#endif // defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
// Mutex
_LIBCPP_THREAD_ABI_VISIBILITY
@ -475,10 +478,10 @@ get_id() _NOEXCEPT
} // this_thread
#endif // !_LIBCPP_HAS_NO_THREADS
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#endif // !_LIBCPP_HAS_NO_THREADS
#endif // _LIBCPP_THREADING_SUPPORT