PCL
|
Automatic mutex lock/unlock. More...
#include <AutoLock.h>
Public Member Functions | |
AutoLock (AutoLock &&x) | |
AutoLock (const AutoLock &)=delete | |
AutoLock (pcl::Mutex &mutex) | |
~AutoLock () | |
void | Lock () |
AutoLock & | operator= (AutoLock &&)=delete |
AutoLock & | operator= (const AutoLock &)=delete |
void | Unlock () |
AutoLock is a convenience class that simplifies using Mutex objects to protect code or data that can be accessed by multiple threads.
An AutoLock object locks a Mutex object upon construction and unlocks it upon destruction. This ensures that the state of the Mutex object will always be well defined, and that it will never be left locked, even in critical situations involving multiple function return points and exceptions.
Definition at line 83 of file AutoLock.h.
|
inlineexplicit |
Constructs an AutoLock object to monitor a specified Mutex object.
mutex | A Mutex object that will be monitored by this AutoLock instance. |
The specified mutex object will be locked by this constructor. It will be unlocked automatically when this AutoLock object gets out of scope, or if it is destroyed explicitly.
Definition at line 97 of file AutoLock.h.
|
inline |
Move constructor.
Definition at line 106 of file AutoLock.h.
|
inline |
Destroys this AutoLock object.
If the monitored mutex object (that was specified in the constructor) is locked, it is unlocked by this destructor.
Definition at line 119 of file AutoLock.h.
|
delete |
Copy constructor. This constructor is disabled because AutoLock objects cannot be copied.
|
inline |
Locks the monitored mutex object, if it has not been previously locked by this object.
Definition at line 147 of file AutoLock.h.
Move assignment. This operator is disabled because AutoLock objects cannot be move-assigned.
Copy assignment. This operator is disabled because AutoLock objects cannot be copied.
|
inline |
Unlocks the monitored mutex object, if it has been previously locked by this object.
Definition at line 158 of file AutoLock.h.