Ceylan::System::Mutex Class Reference

Simple mutual exclusion device. More...

#include <CeylanMutex.h>

Inheritance diagram for Ceylan::System::Mutex:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::System::Mutex:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 Mutex ()
 Basic constructor.
virtual ~Mutex () throw ()
 Basic virtual destructor.
virtual void lock ()
 Locks the mutex.
virtual void unlock ()
 Unlocks the mutex.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.
virtual bool mustBeLocked () const
bool isLocked () const
 Returns the lock state, locked or unlocked.

Static Public Member Functions

static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

virtual void postLock ()
 Effective locking of the mutex.
virtual void preUnlock ()
 Effective locking of the mutex.
SystemSpecificMutexType & getMutexReference ()
 Returns the reference on the mutex itself.

Protected Attributes

bool _locked
 This is the actual piece of informations which is used to know the lock state.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 Mutex (const Mutex &source)
 Copy constructor made private to ensure that it will be never called.
Mutexoperator= (const Mutex &source)
 Assignment operator made private to ensure that it will be never called.

Private Attributes

SystemSpecificMutexType * _internalMutex
 The internal mutex type, depending on the platform.


Detailed Description

Simple mutual exclusion device.

Mostly encapsulates POSIX default initialized mutex.

Note:
Mutex can be successfully instanciated if and only if the multithreading feature was enabled during the configuration step of the Ceylan library being used at run-time.
See also:
Feature::isMultithreadingSupported

Definition at line 63 of file CeylanMutex.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Mutex::Mutex (  ) 

Basic constructor.

Exceptions:
Features::FeatureNotAvailableException if the multithreading feature is available.

Definition at line 76 of file CeylanMutex.cc.

References _internalMutex.

Mutex::~Mutex (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 98 of file CeylanMutex.cc.

References _internalMutex.

Ceylan::System::Mutex::Mutex ( const Mutex source  )  [private]

Copy constructor made private to ensure that it will be never called.

Note:
If this copy constructor had to be defined, then if would have to be explicitly defined since the version defined by the compiler would imply memberwise (shallow) copy, whereas the _internalMutex should be duplicated, as it is owned (not used) by its Mutex object.


Member Function Documentation

Mutex::SystemSpecificMutexType & Mutex::getMutexReference (  )  [protected]

Returns the reference on the mutex itself.

Definition at line 237 of file CeylanMutex.cc.

References _internalMutex.

Referenced by Ceylan::System::Thread::Thread::Waiter::wait().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

bool Ceylan::Lockable::isLocked (  )  const [inline, inherited]

Returns the lock state, locked or unlocked.

Note:
Only one of the few inlines for performance reasons.

Definition at line 251 of file CeylanLockable.h.

void Mutex::lock (  )  [virtual]

bool Lockable::mustBeLocked (  )  const [virtual, inherited]

Mutex& Ceylan::System::Mutex::operator= ( const Mutex source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void Mutex::postLock (  )  [protected, virtual]

Effective locking of the mutex.

Exceptions:
LockException if the effective locking failed.

Reimplemented from Ceylan::Lockable.

Definition at line 139 of file CeylanMutex.cc.

References _internalMutex.

Referenced by lock().

void Mutex::preUnlock (  )  [protected, virtual]

Effective locking of the mutex.

Exceptions:
LockException if the effective locking failed.

Reimplemented from Ceylan::Lockable.

Definition at line 183 of file CeylanMutex.cc.

References _internalMutex.

Referenced by unlock().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const std::string Mutex::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::Lockable.

Definition at line 228 of file CeylanMutex.cc.

void Mutex::unlock (  )  [virtual]


Member Data Documentation

SystemSpecificMutexType* Ceylan::System::Mutex::_internalMutex [private]

The internal mutex type, depending on the platform.

Definition at line 212 of file CeylanMutex.h.

Referenced by getMutexReference(), Mutex(), postLock(), preUnlock(), and ~Mutex().

bool Ceylan::Lockable::_locked [protected, inherited]

This is the actual piece of informations which is used to know the lock state.

Definition at line 217 of file CeylanLockable.h.

Referenced by lock(), Ceylan::Lockable::lock(), Ceylan::Lockable::toString(), unlock(), Ceylan::Lockable::unlock(), and Ceylan::Lockable::~Lockable().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().


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

Generated on Thu Jun 4 20:41:02 2009 for Ceylan by  doxygen 1.5.8