3 #include <boost/date_time/posix_time/ptime.hpp>
4 #include <boost/function.hpp>
5 #include <boost/system/error_code.hpp>
7 namespace RobotRaconteur
31 using unique_lock = null_lock<T>;
33 using shared_lock = null_lock<T>;
35 using upgrade_lock = null_lock<T>;
37 using upgrade_to_unique_lock = null_lock<T>;
52 throw std::runtime_error(
"Operation requires threading");
55 template <
typename U,
typename V>
56 void timed_wait(U& u, V v)
58 throw std::runtime_error(
"Operation requires threading");
61 template <
typename U,
typename V>
62 void wait_for(U& u, V v)
64 throw std::runtime_error(
"Operation requires threading");
67 typedef unique_lock<null_mutex> scoped_lock;
70 typedef boost::null_mutex mutex;
71 typedef boost::null_mutex recursive_mutex;
72 typedef boost::null_mutex shared_mutex;
73 typedef boost::null_mutex condition_variable;
94 typedef io_service_work work;
95 typedef strand strand;
97 bool stopped() {
return false; }
99 void post(boost::function<
void()> f);
104 deadline_timer(io_service& service);
105 deadline_timer(io_service& service, boost::posix_time::time_duration duration);
107 void expires_from_now(boost::posix_time::time_duration duration);
108 boost::posix_time::time_duration expires_from_now();
109 void expires_at(boost::posix_time::ptime duration);
110 void async_wait(boost::function<
void(boost::system::error_code)> f);
112 void cancel(boost::system::error_code ec);
116 boost::shared_ptr<RobotRaconteur::WallTimer> timer;
121 template <
typename T>
122 class thread_specific_ptr
127 thread_specific_ptr() : val_(0) {}
128 thread_specific_ptr(T* val) : val_(val) {}
139 void reset() { reset(0); }
141 T* get() {
return val_; }
143 T& operator*() {
return *val_; }
150 template <
typename U>
157 typedef boost::posix_time::ptime system_time;
159 namespace this_thread
161 template <
typename T>
162 static void sleep(T& t)
164 throw std::runtime_error(
"Operation requires threading");
171 #undef RR_BOOST_ASIO_STRAND_WRAP
172 #define RR_BOOST_ASIO_STRAND_WRAP(strand, f) (f)