39 #ifndef RTT_READ_WRITE_POINTER_HPP 40 #define RTT_READ_WRITE_POINTER_HPP 42 #include <boost/intrusive_ptr.hpp> 43 #include <boost/call_traits.hpp> 45 #include "../os/Mutex.hpp" 46 #include "../os/MutexLock.hpp" 59 : value(value), readers(0) {}
68 return (--readers) != 0;
101 boost::intrusive_ptr<Internal>
internal;
108 typename traits::const_reference
operator *()
const {
return *(
internal->value); }
109 T
const* operator ->()
const {
return internal->value; }
113 {
return internal->value != 0; }
117 return internal->value;
143 boost::intrusive_ptr<Internal> safe = this->
internal;
146 internal =
new Internal(ptr);
150 if (safe->value == ptr)
154 if (safe->readers == 2)
168 internal =
new Internal(ptr);
182 boost::intrusive_ptr<Internal> safe = this->
internal;
187 if (safe->readers == 2)
191 std::swap(value, safe->value);
214 boost::intrusive_ptr<Internal> safe = this->
internal;
219 if (safe->readers == 2)
223 std::swap(value, safe->value);
228 return new T(*safe->value);
An object oriented wrapper around a non recursive mutex.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
MutexLock is a scope based Monitor, protecting critical sections with a Mutex object through locking ...