Ceylan::System::Thread::Thread::Waiter Class Reference

#include <CeylanThread.h>

Inheritance diagram for Ceylan::System::Thread::Thread::Waiter:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::System::Thread::Thread::Waiter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Waiter ()
 Basic constructor.
 ~Waiter () throw ()
 Basic non-virtual destructor.
bool wait (System::Second seconds=0)
 Blocks for sec seconds the calling thread, until time is elapsed, or signal() or broadcast() is called by another thread.
bool signal ()
 Signals only one waiting thread.
bool broadcast ()
 Signals all waiting threads.

Protected Types

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

Protected Member Functions

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 void postLock ()
 Effective locking of the mutex.
virtual void preUnlock ()
 Effective locking of the mutex.
SystemSpecificMutexType & getMutexReference ()
 Returns the reference on the mutex itself.
virtual bool mustBeLocked () const
bool isLocked () const
 Returns the lock state, locked or unlocked.

Static Protected 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 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

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

Private Attributes

SystemSpecificThreadCondition * _condition
 This Waiter's system-specific condition variable, since multiple threads can wait on a single Waiter.


Detailed Description

Definition at line 374 of file CeylanThread.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

Thread::Waiter::Waiter (  ) 

Basic constructor.

Exceptions:
FeatureNotAvailableException if the multithreading feature is not available, so that no Waiter instance can be created in this case.
See also:
Feature::isMultithreadingSupported

Definition at line 558 of file CeylanThread.cc.

References Ceylan::System::Thread::Thread::Waiter::_condition.

Thread::Waiter::~Waiter (  )  throw ()

Basic non-virtual destructor.

Definition at line 584 of file CeylanThread.cc.

References Ceylan::System::Thread::Thread::Waiter::_condition.

Ceylan::System::Thread::Thread::Waiter::Waiter ( const Waiter source  )  [private]

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

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


Member Function Documentation

bool Thread::Waiter::broadcast (  ) 

Signals all waiting threads.

Returns:
true if the operation succeeded. Always returns true if the multithreading feature is not available.

Definition at line 711 of file CeylanThread.cc.

References Ceylan::System::Thread::Thread::Waiter::_condition, Ceylan::System::Mutex::lock(), generalUtils::true, and Ceylan::System::Mutex::unlock().

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

Returns the reference on the mutex itself.

Definition at line 237 of file CeylanMutex.cc.

References Ceylan::System::Mutex::_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, inherited]

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

Waiter& Ceylan::System::Thread::Thread::Waiter::operator= ( const Waiter 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, inherited]

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 Ceylan::System::Mutex::_internalMutex.

Referenced by Ceylan::System::Mutex::lock().

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

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 Ceylan::System::Mutex::_internalMutex.

Referenced by Ceylan::System::Mutex::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().

bool Thread::Waiter::signal (  ) 

Signals only one waiting thread.

Returns:
true if the operation succeeded. Always returns true if the multithreading feature is not available.

Definition at line 682 of file CeylanThread.cc.

References Ceylan::System::Thread::Thread::Waiter::_condition, Ceylan::System::Mutex::lock(), generalUtils::true, and Ceylan::System::Mutex::unlock().

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, inherited]

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, inherited]

bool Thread::Waiter::wait ( System::Second  seconds = 0  ) 

Blocks for sec seconds the calling thread, until time is elapsed, or signal() or broadcast() is called by another thread.

Parameters:
seconds the requested sleeping time, if null no timeout will occur.
Returns:
true if the thread has not been signaled during the requesting time. Always returns true if the multithreading feature is not available.

Definition at line 608 of file CeylanThread.cc.

References Ceylan::System::Thread::Thread::Waiter::_condition, Ceylan::System::Mutex::getMutexReference(), Ceylan::System::Mutex::lock(), Ceylan::toString(), generalUtils::true, and Ceylan::System::Mutex::unlock().


Member Data Documentation

SystemSpecificThreadCondition* Ceylan::System::Thread::Thread::Waiter::_condition [private]

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 Ceylan::System::Mutex::lock(), Ceylan::Lockable::lock(), Ceylan::Lockable::toString(), Ceylan::System::Mutex::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:11 2009 for Ceylan by  doxygen 1.5.8