3#include <boost/date_time/posix_time/ptime.hpp>
4#include <boost/function.hpp>
5#include <boost/system/error_code.hpp>
6#include <boost/shared_ptr.hpp>
8namespace RobotRaconteur
32using unique_lock = null_lock<T>;
34using shared_lock = null_lock<T>;
36using upgrade_lock = null_lock<T>;
38using upgrade_to_unique_lock = null_lock<T>;
53 throw std::runtime_error(
"Operation requires threading");
56 template <
typename U,
typename V>
57 void timed_wait(U& u, V v)
59 throw std::runtime_error(
"Operation requires threading");
62 template <
typename U,
typename V>
63 void wait_for(U& u, V v)
65 throw std::runtime_error(
"Operation requires threading");
68 typedef unique_lock<null_mutex> scoped_lock;
71typedef boost::null_mutex mutex;
72typedef boost::null_mutex recursive_mutex;
73typedef boost::null_mutex shared_mutex;
74typedef boost::null_mutex condition_variable;
95 typedef io_service_work work;
96 typedef strand strand;
98 bool stopped() {
return false; }
100 void post(boost::function<
void()> f);
105 deadline_timer(io_service& service);
106 deadline_timer(io_service& service, boost::posix_time::time_duration duration);
108 void expires_from_now(boost::posix_time::time_duration duration);
109 boost::posix_time::time_duration expires_from_now();
110 void expires_at(boost::posix_time::ptime duration);
111 void async_wait(boost::function<
void(boost::system::error_code)> f);
113 void cancel(boost::system::error_code ec);
117 boost::shared_ptr<RobotRaconteur::WallTimer> timer;
123class thread_specific_ptr
128 thread_specific_ptr() : val_(0) {}
129 thread_specific_ptr(T* val) : val_(val) {}
140 void reset() { reset(0); }
142 T* get() {
return val_; }
144 T& operator*() {
return *val_; }
151 template <
typename U>
158typedef boost::posix_time::ptime system_time;
163static void sleep(T& t)
165 throw std::runtime_error(
"Operation requires threading");
172#undef RR_BOOST_ASIO_STRAND_WRAP
173#define RR_BOOST_ASIO_STRAND_WRAP(strand, f) (f)