provide Win32 native threading
Add an implementation for the Win32 threading model as a backing API for
the internal c++ threading interfaces. This uses the Fls* family for
the TLS (which has the support for adding termination callbacks),
CRITICAL_SECTIONs for the recursive mutex, and Slim Reader/Writer locks
(SRW locks) for non-recursive mutexes. These APIs should all be
available on Vista or newer.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291333 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/thread b/include/thread
index b5b96e8..479e3c0 100644
--- a/include/thread
+++ b/include/thread
@@ -148,7 +148,8 @@
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
- static void __at_thread_exit(void*);
+ static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
+
public:
typedef _Tp* pointer;
@@ -164,7 +165,7 @@
};
template <class _Tp>
-void
+void _LIBCPP_TLS_DESTRUCTOR_CC
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
{
delete static_cast<pointer>(__p);
@@ -173,12 +174,10 @@
template <class _Tp>
__thread_specific_ptr<_Tp>::__thread_specific_ptr()
{
- int __ec = __libcpp_tls_create(
- &__key_,
- &__thread_specific_ptr::__at_thread_exit);
- if (__ec)
- __throw_system_error(__ec,
- "__thread_specific_ptr construction failed");
+ int __ec =
+ __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+ if (__ec)
+ __throw_system_error(__ec, "__thread_specific_ptr construction failed");
}
template <class _Tp>