3 #ifndef __CDS_OS_POSIX_THREAD_H
4 #define __CDS_OS_POSIX_THREAD_H
8 namespace cds { namespace OS {
9 /// posix-related wrappers
11 /// Checks if thread \p id is alive
12 static inline bool isThreadAlive( std::thread::id id )
14 // if sig is zero, error checking is performed but no signal is actually sent.
15 // ESRCH - No thread could be found corresponding to that specified by the given thread ID
16 // Unresolved problem: Linux may crash on dead thread_id. Workaround unknown (except signal handler...)
17 return pthread_kill( id, 0 ) != ESRCH;
20 /// Default back-off thread strategy (yield)
21 static inline void backoff()
23 std::this_thread::yield();
28 using posix::isThreadAlive;
31 }} // namespace cds::OS
34 #endif // #ifndef __CDS_OS_POSIX_THREAD_H