#include <synchronized.h>
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 |
CVD::Synchronized::Synchronized | ( | ) |
Create an initially unlocked mutex.
virtual CVD::Synchronized::~Synchronized | ( | ) | [virtual] |
The lock is acquired before deconstruction.
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 |