Anp::Mutex Class Reference

#include <Mutex.h>

List of all members.

Public Member Functions

 Mutex ()
 ~Mutex ()
int Lock (void)
int UnLock (void)
int TryLock (void)
pthread_mutex_t * get_pthread_mutex ()

Private Attributes

pthread_mutex_t fMutex

Detailed Description

Definition at line 59 of file Mutex.h.


Constructor & Destructor Documentation

Anp::Mutex::Mutex (  )  [inline]

Definition at line 117 of file Mutex.h.

References fMutex.

00118       :fMutex()
00119    {
00120       const int status_init = pthread_mutex_init(&fMutex, NULL);
00121       assert(status_init == 0 && "pthread_mutex_init() failed");  
00122    }

Anp::Mutex::~Mutex (  )  [inline]

Definition at line 124 of file Mutex.h.

References fMutex.

00125    {
00126       const int status_destroy = pthread_mutex_destroy(&fMutex);
00127       assert(status_destroy == 0 && "pthread_mutex_destroy() failed");    
00128    }


Member Function Documentation

pthread_mutex_t * Anp::Mutex::get_pthread_mutex (  )  [inline]

Definition at line 151 of file Mutex.h.

References fMutex.

Referenced by Anp::CondVar::Wait().

00152    {
00153       return &fMutex;
00154    }

int Anp::Mutex::Lock ( void   )  [inline]

Definition at line 130 of file Mutex.h.

References fMutex.

Referenced by Anp::RunAlgSnarl::Config().

00131    {
00132       const int status_lock = pthread_mutex_lock(&fMutex);
00133       assert(status_lock == 0 && "pthread_mutex_lock() failed");    
00134       return status_lock;
00135    }

int Anp::Mutex::TryLock ( void   )  [inline]

Definition at line 137 of file Mutex.h.

References fMutex.

00138    {      
00139       const int status_trylock = pthread_mutex_trylock(&fMutex);
00140       assert(status_trylock == 0 && "pthread_mutex_trylock() failed");    
00141       return status_trylock;
00142    }

int Anp::Mutex::UnLock ( void   )  [inline]

Definition at line 144 of file Mutex.h.

References fMutex.

Referenced by Anp::RunAlgSnarl::Config().

00145    {      
00146       const int status_unlock = pthread_mutex_unlock(&fMutex);
00147       assert(status_unlock == 0 && "pthread_mutex_unlock() failed");    
00148       return status_unlock;
00149    }


Member Data Documentation

pthread_mutex_t Anp::Mutex::fMutex [private]

Definition at line 82 of file Mutex.h.

Referenced by get_pthread_mutex(), Lock(), Mutex(), TryLock(), UnLock(), and ~Mutex().


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

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1