Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

L1394::ThreadMutex Class Reference

This class is a wrapper for the pthread_mutex variables. More...

#include <Thread.hpp>

List of all members.

Public Types

enum  MutexKind { FAST, RECURSIVE }

Public Member Functions

 ThreadMutex (MutexKind mutex_kind=FAST)
 Constructor.
 ~ThreadMutex ()
 Destructor.
void lock () const
 This method locks the mutex.
void unlock () const
 This method unlocks the mutex.
int tryLock () const
 This method differs form lock, that this method returns imediatly.

Friends

class ThreadCondition


Detailed Description

This class is a wrapper for the pthread_mutex variables.

Definition at line 11 of file Thread.hpp.


Member Enumeration Documentation

enum L1394::ThreadMutex::MutexKind
 

Enumeration values:
FAST 
RECURSIVE 

Definition at line 15 of file Thread.hpp.


Constructor & Destructor Documentation

L1394::ThreadMutex::ThreadMutex MutexKind  mutex_kind = FAST  ) 
 

Constructor.

Parameters:
MutexKind : This parameter determines whether a ThreadMutex can be locked again by a thread that already owns it (Recursive) or not (Fast). Default value is Fast.

Definition at line 11 of file Thread.cpp.

L1394::ThreadMutex::~ThreadMutex  ) 
 

Destructor.

Definition at line 18 of file Thread.cpp.


Member Function Documentation

void L1394::ThreadMutex::lock  )  const
 

This method locks the mutex.

If the mutex is currently unlocked, it becomes locked and owned by the calling thread. If the mutex is already locked by another thread, the mutex suspends the calling thread until the mutex is unlocked. If the MutexKind is 'Recursive' and the current thread locks again, a counter is increased.

Definition at line 51 of file Thread.cpp.

References FAST, and RECURSIVE.

Referenced by L1394_MM::Window::connect(), L1394_MM::Window::disconnect(), L1394::internal::NodeContainer::findNode(), L1394::internal::DccIso::flushQueue(), L1394::internal::DvIso::getFrame(), L1394::internal::DccIso::getFrame(), L1394::internal::NodeContainer::getNode(), L1394::internal::NodeContainer::getNodeContainer(), L1394::internal::NodeFactory::getNodeFactory(), L1394::internal::NodeContainer::insert(), L1394::MutexGuard::lock(), L1394::internal::DvIso::releaseFrame(), L1394::internal::DccIso::releaseFrame(), L1394::internal::NodeContainer::removeNode(), L1394::Card::requestTransaction(), L1394::internal::DccIso::setParameter(), L1394_MM::Window::stop(), L1394::internal::DccIso::stopIsoListen(), L1394::internal::NodeContainer::~NodeContainer(), and L1394::internal::NodeFactory::~NodeFactory().

int L1394::ThreadMutex::tryLock  )  const
 

This method differs form lock, that this method returns imediatly.

Return value is FAILURE if the mutex is already locked by another thread else SUCCESS

Definition at line 22 of file Thread.cpp.

References FAST, L1394_FAILED, L1394_SUCCESS, and RECURSIVE.

void L1394::ThreadMutex::unlock  )  const
 

This method unlocks the mutex.

If the MutexKind 'Fast', unlock releases the mutex. If MutexKind is 'Recursive', it decrements the locking count of the mutex and only when this count reaches zero the mutex is released.

Definition at line 75 of file Thread.cpp.

References FAST, and RECURSIVE.

Referenced by L1394_MM::Window::connect(), L1394_MM::Window::disconnect(), L1394::internal::NodeContainer::findNode(), L1394::internal::DccIso::flushQueue(), L1394::internal::DvIso::getFrame(), L1394::internal::DccIso::getFrame(), L1394::internal::NodeContainer::getNode(), L1394::internal::NodeContainer::getNodeContainer(), L1394::internal::NodeFactory::getNodeFactory(), L1394::internal::NodeContainer::insert(), L1394::internal::DvIso::releaseFrame(), L1394::internal::DccIso::releaseFrame(), L1394::Card::releaseTransaction(), L1394::internal::NodeContainer::removeNode(), L1394::internal::DccIso::setParameter(), L1394_MM::Window::stop(), L1394::internal::DccIso::stopIsoListen(), L1394::MutexGuard::unlock(), L1394::MutexGuard::~MutexGuard(), L1394::internal::NodeContainer::~NodeContainer(), and L1394::internal::NodeFactory::~NodeFactory().


Friends And Related Function Documentation

friend class ThreadCondition [friend]
 

Definition at line 13 of file Thread.hpp.


The documentation for this class was generated from the following files:
Generated on Wed Aug 24 00:36:45 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/