35 #ifndef CARTOBASE_SMART_MUTEXRCPTR_H 36 #define CARTOBASE_SMART_MUTEXRCPTR_H 47 #ifndef CARTO_NO_THREAD 69 mutable Mutex *_mutex;
97 bool operator < ( const MutexRcPtr<T> &other )
const;
100 int refCount()
const;
146 template <
typename T>
152 template <
typename T>
157 ptr->mutex()->lock();
159 ptr->mutex()->unlock();
164 template <
typename T>
173 template <
typename T>
180 template <
typename T>
187 if( _rcptr.refCount() == 1 )
190 t->mutex()->unlock();
196 t->mutex()->unlock();
202 ptr->mutex()->lock();
204 ptr->mutex()->unlock();
209 template <
typename T>
220 template <
typename T>
227 t->mutex()->unlock();
231 template <
typename T>
238 _rcptr = other._rcptr;
243 template <
typename T>
250 template <
typename T>
257 template <
typename T>
260 return get() < other.
get();
264 template <
typename T>
267 return get() == other.
get();
271 template <
typename T>
274 return get() != other.
get();
278 template <
typename T>
282 int x = _rcptr.refCount();
288 template <
typename T>
295 template <
typename T>
299 return t ? t->mutex() : 0;
303 template <
typename T>
312 template <
typename T>
MutexRcPtr< T > & operator=(MutexRcPtr< T > &other)
Base class for reference counted objects (intrusive)
RCObject & operator=(const RCObject &)
bool operator==(const carto::block< T, N > &b1, const carto::block< T, N > &b2)
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
bool operator<(const MutexRcPtr< T > &other) const
Reference-counting pointer.
bool operator!=(const MutexRcPtr< T > &other) const
rc_ptr< T > rcptr()
not thread-safe, almost private, for low-level operation only
MutexedObject & operator=(const MutexedObject &)
bool operator==(const MutexRcPtr< T > &other) const
MutexedObject::Mutex * mutex()