9 #ifndef _STRUS_THREAD_HPP_INCLUDED
10 #define _STRUS_THREAD_HPP_INCLUDED
14 #define STRUS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
17 #undef STRUS_USE_STD_THREAD
18 #if __cplusplus >= 201103L
20 #define STRUS_USE_STD_THREAD
21 #elif defined __GNUC__
22 #if STRUS_GCC_VERSION >= 40900
23 #define STRUS_USE_STD_THREAD
24 #endif // STRUS_GCC_VERSION
28 #ifdef STRUS_USE_STD_THREAD
30 #include <condition_variable>
45 :
public std::vector<std::thread*>
50 std::vector<std::thread*>::const_iterator ti = begin(), te = end();
51 for (; ti != te; ++ti)
delete *ti;
59 std::vector<std::thread*>::iterator ti = begin(), te = end();
60 for (; ti != te; ++ti) (*ti)->join();
67 typedef std::thread::id
Type;
70 return std::this_thread::get_id();
76 #else //STRUS_USE_STD_THREAD
77 #include <boost/thread/mutex.hpp>
78 #include <boost/thread/recursive_mutex.hpp>
79 #include <boost/thread/condition_variable.hpp>
80 #include <boost/thread.hpp>
95 typedef boost::thread::id
Type;
98 return boost::this_thread::get_id();
104 #endif //STRUS_USE_STD_THREAD
boost::mutex mutex
Definition: thread.hpp:84
boost::unique_lock< boost::recursive_mutex > recursive_unique_lock
Definition: thread.hpp:88
boost::thread thread
Definition: thread.hpp:90
boost::condition_variable condition_variable
Definition: thread.hpp:89
boost::mutex::scoped_lock scoped_lock
Definition: thread.hpp:86
Definition: thread.hpp:92
boost::unique_lock< boost::mutex > unique_lock
Definition: thread.hpp:87
boost::recursive_mutex recursive_mutex
Definition: thread.hpp:85
boost::thread::id Type
Definition: thread.hpp:95