mirror of
https://github.com/edubart/otclient.git
synced 2025-12-14 20:59:47 +01:00
Use boost::thread instead of std::thread
This commit is contained in:
@@ -24,14 +24,15 @@
|
||||
#define THREAD_H
|
||||
|
||||
// hack to enable std::thread on mingw32 4.6
|
||||
#if !defined(_GLIBCXX_HAS_GTHREADS) && defined(__GNUG__)
|
||||
#if 1
|
||||
//#if !defined(_GLIBCXX_HAS_GTHREADS) && defined(__GNUG__)
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
namespace std {
|
||||
namespace stdext {
|
||||
using boost::thread;
|
||||
using boost::future;
|
||||
using boost::future_status;
|
||||
@@ -49,21 +50,43 @@ namespace std {
|
||||
using boost::condition_variable_any;
|
||||
|
||||
template<typename R>
|
||||
bool is_ready(std::future<R>& f)
|
||||
bool is_ready(stdext::future<R>& f)
|
||||
{ return f.wait_for(boost::chrono::seconds(0)) == future_status::ready; }
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <future>
|
||||
|
||||
namespace std {
|
||||
namespace stdext {
|
||||
template<typename R>
|
||||
bool is_ready(std::future<R>& f)
|
||||
{ return f.wait_for(chrono::seconds(0)) == future_status::ready; }
|
||||
};
|
||||
namespace stdext {
|
||||
using std::thread;
|
||||
using std::future;
|
||||
using std::future_status;
|
||||
using std::promise;
|
||||
|
||||
using std::mutex;
|
||||
using std::timed_mutex;
|
||||
using std::recursive_mutex;
|
||||
using std::recursive_timed_mutex;
|
||||
|
||||
using std::lock_guard;
|
||||
using std::unique_lock;
|
||||
|
||||
using std::condition_variable;
|
||||
using std::condition_variable_any;
|
||||
|
||||
template<typename R>
|
||||
bool is_ready(std::future<R>& f)
|
||||
{ return f.wait_for(boost::chrono::seconds(0)) == future_status::ready; }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user