Class: TMonitorCondition

Declaration: Synchronization.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TReentrantMonitorCondition

Purpose:

A concrete class used to implement conditions in the monitor and conditions programming model.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Derived classes override the virtual member functions and add additional member functions. Clients should be careful to implement the proper monitor and conditions programming model semantics when overriding the virtual member functions.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TMonitorCondition::TMonitorCondition

  1. TMonitorCondition (TMonitorLock * theLock)
  2. TMonitorCondition (TMonitorLock * theLock, const TTime & maximumDelay)

Interface Category:

API.

Purpose:

  1. Constructor.
  2. Constructor.

Calling Context:

  1. Called to create a condition object associated with a particular monitor.
  2. Called to create a condition object associated with a particular monitor.

Parameters:

Return Value:

None.

Exceptions:

Throws TMonitorException(TMonitorException::kInvalidMonitor) if theLock is NIL. Throws TMonitorException(TMonitorException::kConditionInitializationFailed) if an error occurred while initializing the internal state of the object. Throws TSemaphoreException(TSemaphoreException::kBadWaitTimeArgument) if a negative timeout delay is passed.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::~TMonitorCondition

virtual ~ TMonitorCondition ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::Wait

  1. virtual void Wait ()
  2. virtual void Wait (const TTime & maximumTimeToWait)

Interface Category:

API.

Purpose:

  1. Waits for a condition to be signaled.
  2. Waits for a condition to be signaled.

Calling Context:

  1. Called by a thread that has obtained the monitor with which the condition is associated.
  2. Called by a thread that has obtained the monitor with which the condition is associated.

Parameters:

Return Value:

None.

Exceptions:

Throws TMonitorException(TMonitorException::kConditionWaitFailed) if an error occurred while waiting on the condition. Throws TSemaphoreException(TSemaphoreException::kBadWaitTimeArgument) if a negative timeout delay is passed.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::Notify

virtual void Notify ()

Interface Category:

API.

Purpose:

Signals one waiter that the condition has occurred.

Calling Context:

Called by a thread that holds the monitor with which the condition is associated.

Parameters:

Return Value:

None.

Exceptions:

Throws TMonitorException(TMonitorException::kConditionSignalFailed) if an error occurred while signaling the condition.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::Broadcast

virtual void Broadcast ()

Interface Category:

API.

Purpose:

Signals all waiters that the condition has occurred.

Calling Context:

Called by a thread that holds the monitor with which the condition is associated.

Parameters:

Return Value:

None.

Exceptions:

Throws TMonitorException(TMonitorException::kConditionSignalFailed) if an error occurred while signaling the condition.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::GetDefaultDelay

void GetDefaultDelay (TTime & theTime) const

Interface Category:

API.

Purpose:

Returns the default wait time used when waiting for the condition to be signaled.

Calling Context:

Called to query the internal state of the TMonitorCondition object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TMonitorCondition::SetDefaultDelay

virtual void SetDefaultDelay (const TTime & maximumDelay)

Interface Category:

API.

Purpose:

Set the default wait time used when waiting for the condition to be signaled.

Calling Context:

Called to change the wait time for the condition.

Parameters:

Return Value:

None.

Exceptions:

Throws TMonitorException(TMonitorException::kCantDetermineCause) if an error occurred while setting the delay time.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.