#include <mutex.hpp>
Public Member Functions | |
mutex_sentry (mutex &mx) | |
Calls mx.lock(). | |
~mutex_sentry () throw () | |
Unlocks the mutex we locked in the ctor. |
The intended usage is to instantiate it at the start of a routine which needs a lock. The instantiation will not return until the lock is acquired or the locking function throws an exception. Upon destruction of this object, the mutex will be unlocked.
Note that these objects are not copyable.
Definition at line 82 of file mutex.hpp.
s11n::mutex_sentry::mutex_sentry | ( | mutex & | mx | ) | [explicit] |
Calls mx.lock().
mx must outlive this object.
s11n::mutex_sentry::~mutex_sentry | ( | ) | throw () |
Unlocks the mutex we locked in the ctor.