|
BehaviorTree
Core Library to create and execute Behavior Trees
|
The LockedPtr class is used to share a pointer to an object and a mutex that protects the read/write access to that object. More...
#include <locked_reference.hpp>
Public Member Functions | |
| LockedPtr (T *obj, std::mutex *obj_mutex) | |
| LockedPtr (LockedPtr const &)=delete | |
| LockedPtr & | operator= (LockedPtr const &)=delete |
| LockedPtr (LockedPtr &&other) noexcept | |
| LockedPtr & | operator= (LockedPtr &&other) noexcept |
| operator bool () const | |
| void | lock () |
| void | unlock () |
| const T * | get () const |
| const T * | operator-> () const |
| T * | operator-> () |
| template<typename OtherT > | |
| void | assign (const OtherT &other) |
The LockedPtr class is used to share a pointer to an object and a mutex that protects the read/write access to that object.
As long as the object remains in scope, the mutex is locked, therefore you must destroy this instance as soon as the pointer was used.