CVD::Synchronized Class Reference

#include <synchronized.h>

Inheritance diagram for CVD::Synchronized:

CVD::EventObject

List of all members.


Detailed Description

A Synchronized object encapsulates a basic mutex.

Only one thread can own the lock at a time. Classes should subclass from Synchronized if they want to be able to lock themselves.

Definition at line 14 of file synchronized.h.


Public Member Functions

 Synchronized ()
virtual ~Synchronized ()
void lock () const
void unlock () const

Protected Attributes

pthread_mutex_t myMutex

Static Protected Attributes

static
pthread_mutexattr_t 
ourAttr
static bool ourInitFlag

Constructor & Destructor Documentation

CVD::Synchronized::Synchronized (  ) 

Create an initially unlocked mutex.

virtual CVD::Synchronized::~Synchronized (  )  [virtual]

The lock is acquired before deconstruction.


Member Function Documentation

void CVD::Synchronized::lock (  )  const

Acquire the lock; this blocks until the lock is available.

This can be called multiple times by the same thread without deadlocking. Each call should have a matching unlock() call.

Referenced by CVD::Lock::Lock(), CVD::MessageQueue< std::tr1::shared_ptr< CVD::Runnable > >::read(), CVD::MessageQueue< std::tr1::shared_ptr< CVD::Runnable > >::write(), and CVD::ReadAheadVideoBuffer< T >::~ReadAheadVideoBuffer().

void CVD::Synchronized::unlock (  )  const

Release the lock.

Referenced by CVD::MessageQueue< std::tr1::shared_ptr< CVD::Runnable > >::read(), CVD::MessageQueue< std::tr1::shared_ptr< CVD::Runnable > >::write(), CVD::Lock::~Lock(), and CVD::ReadAheadVideoBuffer< T >::~ReadAheadVideoBuffer().


The documentation for this class was generated from the following file:
Generated on Wed Feb 18 10:23:08 2009 for CVD by  doxygen 1.5.3