3 #ifndef CDSLIB_OS_WIN_THREAD_H
4 #define CDSLIB_OS_WIN_THREAD_H
9 namespace cds { namespace OS {
10 /// Windows-specific functions
11 CDS_CXX11_INLINE_NAMESPACE namespace Win32 {
13 /// OS-specific type of thread identifier
14 typedef DWORD ThreadId;
16 /// Get current thread id
17 static inline ThreadId get_current_thread_id()
19 return ::GetCurrentThreadId();
22 /// Tests whether the thread is alive
23 static inline bool is_thread_alive( ThreadId id )
25 HANDLE h = ::OpenThread( SYNCHRONIZE, FALSE, id );
34 CDS_CONSTEXPR const Win32::ThreadId c_NullThreadId = 0;
36 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
37 using Win32::ThreadId;
38 using Win32::get_current_thread_id;
39 using Win32::is_thread_alive;
43 }} // namespace cds::OS
45 #endif // #ifndef CDSLIB_OS_WIN_THREAD_H