1 /* 2 * SObjectizer-5 3 */ 4 5 /*! 6 * \since 7 * v.5.4.0 8 * 9 * \file 10 * \brief A workaround for very slow implementation of 11 * std::this_thread::get_id() under some compilers. 12 * 13 * \note 14 * This header file was actual when too old versions of VC++ compilers 15 * were used. Now it is here for compatibility reasons. 16 */ 17 18 #pragma once 19 20 // For the normal implementations use the standard tools. 21 #include <thread> 22 23 namespace so_5 24 { 25 //! Type of the current thread id. 26 using current_thread_id_t = std::thread::id; 27 28 //! Get the ID of the current thread. 29 inline current_thread_id_t query_current_thread_id()30 query_current_thread_id() 31 { 32 return std::this_thread::get_id(); 33 } 34 35 //! Get NULL thread id. 36 inline current_thread_id_t null_current_thread_id()37 null_current_thread_id() 38 { 39 return std::thread::id(); 40 } 41 42 /*! 43 * \brief Get the raw thread id from current_thread_id. 44 * 45 * \since 46 * v.5.5.18 47 */ 48 inline std::thread::id raw_id_from_current_thread_id(const current_thread_id_t & w)49 raw_id_from_current_thread_id( const current_thread_id_t & w ) 50 { 51 return w; 52 } 53 54 } /* namespace so_5 */ 55 56