lsnes/include/library/threadtypes.hpp
Ilari Liusvaara 13f69fac09 Get rid of platform threads
This was the last platform threading feature, so delete platform
thread files completely.
2013-01-21 12:30:35 +02:00

45 lines
1.2 KiB
C++

#ifndef _library_threadtypes__hpp__included__
#define _library_threadtypes__hpp__included__
#include <cstdint>
#ifdef NATIVE_THREADS
#include <thread>
#include <condition_variable>
#include <mutex>
typedef std::thread thread_class;
typedef std::condition_variable cv_class;
typedef std::mutex mutex_class;
typedef std::unique_lock<std::mutex> umutex_class;
typedef std::chrono::microseconds microsec_class;
typedef std::thread::id threadid_class;
typedef std::thread thread_class;
inline void cv_timed_wait(cv_class& c, umutex_class& m, const microsec_class& t)
{
c.wait_for(m, t);
}
inline threadid_class this_thread_id()
{
return std::this_thread::get_id();
}
#else
#include <boost/thread.hpp>
#include <boost/thread/locks.hpp>
typedef boost::thread thread_class;
typedef boost::condition_variable cv_class;
typedef boost::mutex mutex_class;
typedef boost::unique_lock<boost::mutex> umutex_class;
typedef boost::posix_time::microseconds microsec_class;
typedef boost::thread::id threadid_class;
typedef boost::thread thread_class;
inline void cv_timed_wait(cv_class& c, umutex_class& m, const microsec_class& t)
{
c.timed_wait(m, t);
}
inline threadid_class this_thread_id()
{
return boost::this_thread::get_id();
}
#endif
#endif