Move to std::threading from boost::thread. Still need to sort out thread local storage
This commit is contained in:
parent
99aaa079a4
commit
0a9cb0cbe9
@ -8,7 +8,9 @@
|
|||||||
#define CHAISCRIPT_THREADING_HPP_
|
#define CHAISCRIPT_THREADING_HPP_
|
||||||
|
|
||||||
#ifndef CHAISCRIPT_NO_THREADS
|
#ifndef CHAISCRIPT_NO_THREADS
|
||||||
#include <boost/thread.hpp>
|
#include <thread>
|
||||||
|
#include <mutex>
|
||||||
|
#include <boost/thread/tss.hpp>
|
||||||
#else
|
#else
|
||||||
#pragma message ("ChaiScript is compiling without thread safety.")
|
#pragma message ("ChaiScript is compiling without thread safety.")
|
||||||
#endif
|
#endif
|
||||||
@ -32,11 +34,33 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifndef CHAISCRIPT_NO_THREADS
|
#ifndef CHAISCRIPT_NO_THREADS
|
||||||
using boost::unique_lock;
|
|
||||||
using boost::shared_lock;
|
template<typename T>
|
||||||
using boost::lock_guard;
|
class unique_lock : public std::unique_lock<T>
|
||||||
using boost::shared_mutex;
|
{
|
||||||
using boost::recursive_mutex;
|
public:
|
||||||
|
unique_lock(T &t) : std::unique_lock<T>(t) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class shared_lock : public std::unique_lock<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
shared_lock(T &t) : std::unique_lock<T>(t) {}
|
||||||
|
void unlock() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class lock_guard : public std::lock_guard<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
lock_guard(T &t) : std::lock_guard<T>(t) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class shared_mutex : public std::mutex { };
|
||||||
|
|
||||||
|
using std::recursive_mutex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Typesafe thread specific storage. If threading is enabled, this class uses boost::thread_specific_ptr<T>. If
|
/// Typesafe thread specific storage. If threading is enabled, this class uses boost::thread_specific_ptr<T>. If
|
||||||
|
Loading…
x
Reference in New Issue
Block a user