atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Public Member Functions | List of all members
atscppapi::ScopedMutexTryLock Class Reference

Take a Mutex reference and try to lock inside a scope and unlock when the scope is exited (if the lock was taken). More...

#include "Mutex.h"

Inherits atscppapi::noncopyable.

Public Member Functions

 ScopedMutexTryLock (Mutex &mutex)
 
 ~ScopedMutexTryLock ()
 
bool hasLock ()
 

Detailed Description

Take a Mutex reference and try to lock inside a scope and unlock when the scope is exited (if the lock was taken).

This is an RAII implementation which will lock a mutex at the start of the scope and unlock it when the scope is exited if the lock was taken.

See Also
Mutex

Constructor & Destructor Documentation

atscppapi::ScopedMutexTryLock::ScopedMutexTryLock ( Mutex mutex)
inlineexplicit

Try to create the scoped mutex lock, if you should check hasLock() to determine if this object was successfully able to take the lock.

Parameters
mutexa shared pointer to a Mutex.
atscppapi::ScopedMutexTryLock::~ScopedMutexTryLock ( )
inline

Unlock the mutex (if we hold the lock)

Member Function Documentation

bool atscppapi::ScopedMutexTryLock::hasLock ( )
inline
Returns
True if the lock was taken, False if it was not taken.

The documentation for this class was generated from the following file: