Anp::CondVar Class Reference

#include <Mutex.h>

List of all members.

Public Member Functions

 CondVar (int value=0)
 ~CondVar ()
int Wait (Mutex &mutex)
int Signal ()
void SetValue (int value)
int GetValue ()

Private Member Functions

 CondVar (const CondVar &)
CondVaroperator= (const CondVar &)

Private Attributes

pthread_cond_t fCond
int fValue

Detailed Description

Definition at line 86 of file Mutex.h.


Constructor & Destructor Documentation

Anp::CondVar::CondVar ( int  value = 0  )  [inline]

Definition at line 156 of file Mutex.h.

References fCond.

00157       :fValue(value)
00158    {
00159       const int status_init = pthread_cond_init(&fCond, NULL); 
00160       assert(status_init == 0 && "pthread_cond_init() failed");    
00161    }

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

Definition at line 163 of file Mutex.h.

References fCond.

00164    {
00165       const int status_destroy = pthread_cond_destroy(&fCond); 
00166       assert(status_destroy == 0 && "pthread_cond_destroy() failed");    
00167    }

Anp::CondVar::CondVar ( const CondVar  )  [private]

Member Function Documentation

int Anp::CondVar::GetValue (  )  [inline]

Definition at line 184 of file Mutex.h.

References fValue.

Referenced by Anp::RunAlgSnarl::Run(), and Anp::RunAlgSnarl::RunRecord().

00184 { return fValue; }

CondVar& Anp::CondVar::operator= ( const CondVar  )  [private]
void Anp::CondVar::SetValue ( int  value  )  [inline]

Definition at line 183 of file Mutex.h.

References fValue.

Referenced by Anp::RunAlgSnarl::End(), and Anp::RunAlgSnarl::Run().

00183 { fValue = value; }

int Anp::CondVar::Signal (  )  [inline]

Definition at line 176 of file Mutex.h.

References fCond.

Referenced by Anp::RunAlgSnarl::End(), and Anp::RunAlgSnarl::Run().

00177    {
00178       const int status_signal = pthread_cond_signal(&fCond);
00179       assert(status_signal == 0 && "pthread_cond_signal() failed");
00180       return status_signal;
00181    }

int Anp::CondVar::Wait ( Mutex mutex  )  [inline]

Definition at line 169 of file Mutex.h.

References fCond, and Anp::Mutex::get_pthread_mutex().

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

00170    {
00171       const int status_wait = pthread_cond_wait(&fCond, mutex.get_pthread_mutex());
00172       assert(status_wait == 0 && "pthread_cond_wait() failed");
00173       return status_wait;
00174    }


Member Data Documentation

pthread_cond_t Anp::CondVar::fCond [private]

Definition at line 109 of file Mutex.h.

Referenced by CondVar(), Signal(), Wait(), and ~CondVar().

int Anp::CondVar::fValue [private]

Definition at line 110 of file Mutex.h.

Referenced by GetValue(), and SetValue().


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

Generated on 16 Apr 2018 for loon by  doxygen 1.6.1