35 #ifndef CARTOBASE_SMART_MUTEXRCPTR_H
36 #define CARTOBASE_SMART_MUTEXRCPTR_H
47 #ifndef CARTO_NO_THREAD
69 mutable Mutex *_mutex;
93 const T *
get()
const;
149 template <
typename T>
155 template <
typename T>
160 ptr->mutex()->lock();
162 ptr->mutex()->unlock();
167 template <
typename T>
176 template <
typename T>
183 template <
typename T>
190 if( _rcptr.refCount() == 1 )
193 t->mutex()->unlock();
199 t->mutex()->unlock();
205 ptr->mutex()->lock();
207 ptr->mutex()->unlock();
212 template <
typename T>
223 template <
typename T>
234 template <
typename T>
241 t->mutex()->unlock();
245 template <
typename T>
252 _rcptr = other._rcptr;
257 template <
typename T>
264 template <
typename T>
271 template <
typename T>
278 template <
typename T>
285 template <
typename T>
288 return get() < other.
get();
292 template <
typename T>
295 return get() == other.
get();
299 template <
typename T>
302 return get() != other.
get();
306 template <
typename T>
310 int x = _rcptr.refCount();
316 template <
typename T>
323 template <
typename T>
327 return t ? t->mutex() : 0;
331 template <
typename T>
340 template <
typename T>
bool operator==(const MutexRcPtr< T > &other) const
MutexedObject::Mutex * mutex()
bool operator<(const MutexRcPtr< T > &other) const
bool operator!=(const MutexRcPtr< T > &other) const
rc_ptr< T > rcptr()
not thread-safe, almost private, for low-level operation only
MutexRcPtr< T > & operator=(MutexRcPtr< T > &other)
MutexedObject & operator=(const MutexedObject &)
Base class for reference counted objects (intrusive)
RCObject & operator=(const RCObject &)
Reference-counting pointer.