summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2017-03-20 12:50:52 +0000
committerJose Fonseca <jfonseca@vmware.com>2017-03-20 12:50:52 +0000
commit16b76a287134a08d9db3e57ceb9e772e367a2b86 (patch)
treead03258133cf039c61106ddf7696ec0acf1e7f5d /lib
parent977990ef90d3a79c2215295b3c75a2ecf777a17b (diff)
Remove Windows XP support.
I'm not aware of people using it, so I believe it's not worth the hassle as I'm trying to cut maintenance burden down.
Diffstat (limited to 'lib')
-rw-r--r--lib/os/os_thread.hpp86
-rw-r--r--lib/trace/trace_writer_local.cpp3
2 files changed, 2 insertions, 87 deletions
diff --git a/lib/os/os_thread.hpp b/lib/os/os_thread.hpp
index fa080b91..7190edbc 100644
--- a/lib/os/os_thread.hpp
+++ b/lib/os/os_thread.hpp
@@ -330,82 +330,6 @@ namespace os {
/**
- * Implement TLS through OS threading API.
- *
- * This will only work when T is a pointer, intptr_t, or uintptr_t.
- */
- template <typename T>
- class thread_specific
- {
- private:
- static_assert(sizeof(T) == sizeof(void *), "Size mismatch");
-
-#ifdef _WIN32
- DWORD dwTlsIndex;
-#else
- pthread_key_t key;
-#endif
-
- public:
- thread_specific(void) {
-#ifdef _WIN32
- dwTlsIndex = TlsAlloc();
-#else
- pthread_key_create(&key, NULL);
-#endif
- }
-
- ~thread_specific() {
-#ifdef _WIN32
- TlsFree(dwTlsIndex);
-#else
- pthread_key_delete(key);
-#endif
- }
-
- inline T
- get(void) const {
- void *ptr;
-#ifdef _WIN32
- ptr = TlsGetValue(dwTlsIndex);
-#else
- ptr = pthread_getspecific(key);
-#endif
- return reinterpret_cast<T>(ptr);
- }
-
- inline
- operator T (void) const
- {
- return get();
- }
-
- inline T
- operator -> (void) const
- {
- return get();
- }
-
- inline T
- operator = (T new_value)
- {
- set(new_value);
- return new_value;
- }
-
- inline void
- set(T new_value) {
- void *new_ptr = reinterpret_cast<void *>(new_value);
-#ifdef _WIN32
- TlsSetValue(dwTlsIndex, new_ptr);
-#else
- pthread_setspecific(key, new_ptr);
-#endif
- }
- };
-
-
- /**
* Same interface as std::thread
*/
class thread {
@@ -527,13 +451,5 @@ namespace os {
#elif defined(_MSC_VER)
# define OS_THREAD_LOCAL __declspec(thread)
#else
-# error
+# error Unsupported C++ compiler
#endif
-
-#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
-# define OS_THREAD_SPECIFIC(_type) os::thread_specific< _type >
-#else
-# define OS_THREAD_SPECIFIC(_type) OS_THREAD_LOCAL _type
-#endif
-
-#define OS_THREAD_SPECIFIC_PTR(_type) OS_THREAD_SPECIFIC(_type *)
diff --git a/lib/trace/trace_writer_local.cpp b/lib/trace/trace_writer_local.cpp
index aed1ca78..cd63472b 100644
--- a/lib/trace/trace_writer_local.cpp
+++ b/lib/trace/trace_writer_local.cpp
@@ -154,8 +154,7 @@ LocalWriter::open(void) {
static uintptr_t next_thread_num = 1;
-static OS_THREAD_SPECIFIC(uintptr_t)
-thread_num;
+static OS_THREAD_LOCAL uintptr_t thread_num;
void LocalWriter::checkProcessId(void) {
if (m_file &&