3 #ifndef __CDS_OS_WIN_THREAD_H
4 #define __CDS_OS_WIN_THREAD_H
8 namespace cds { namespace OS {
9 /// Windows-specific functions
12 /// OS-specific type of thread identifier
13 typedef DWORD ThreadId;
15 /// Get current thread id
16 static inline ThreadId getCurrentThreadId()
18 return ::GetCurrentThreadId();
21 /// Tests whether the thread is alive
22 static inline bool isThreadAlive( ThreadId id )
24 HANDLE h = ::OpenThread( SYNCHRONIZE, FALSE, id );
31 /// Default backoff::yield implementation
32 static inline void backoff()
34 std::this_thread::yield();
38 using Win32::ThreadId;
39 CDS_CONSTEXPR const ThreadId c_NullThreadId = 0;
41 using Win32::getCurrentThreadId;
42 using Win32::isThreadAlive;
45 }} // namespace cds::OS
47 #endif // #ifndef __CDS_OS_WIN_THREAD_H