B2BITS FIX Antenna C++ 2.33.0
|
This template class employs a C++ idiom (described by Bjarne Stroustrup) that uses the constructor to acquire a resource automatically when an object of the class is created and uses the destructor to release the resource automatically when it goes out of scope. More...
#include <B2BITS_Guard.h>
Public Member Functions | |
Guard (T &lock) | |
Constructor. | |
void | release () |
Releases the resource. | |
~Guard () | |
Destructor. | |
This template class employs a C++ idiom (described by Bjarne Stroustrup) that uses the constructor to acquire a resource automatically when an object of the class is created and uses the destructor to release the resource automatically when it goes out of scope.
Since Guard is parameterized by the type of lock (such as Mutex), this class can be used with a fam-ily of synchronization wrappers that conform to a uniform interface. E.g.: Guard<Mutex> guard (lock_); // guard constructor acquires m_lock.
|
inline |
Constructor.
Acquires the given resource.
lock | Resource monitor implementation |
|
inline |
|
inline |
Releases the resource.
Referenced by Utils::Guard< T >::~Guard().