Class: TProducerConsumerCondition

Declaration: ProducerConsumer.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

None.

Purpose:

This allows derived classes of producer consumer queue to define additional distinguishing criteria for removing objects. By deriving this, a producer consumer queue derived class could allow its clients to remove objects from its queue that meet certain additional conditions.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

This class is derived to define criteria for removing objects from the queue.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TProducerConsumerCondition::TProducerConsumerCondition

TProducerConsumerCondition (TProducerConsumerQueue *)

Interface Category:

API.

Purpose:

Constructs a condition for use with the given queue. The queue is aliased, not adopted.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::~TProducerConsumerCondition

~ TProducerConsumerCondition ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::RemoveNext

virtual MCollectible * RemoveNext ()

Interface Category:

API.

Purpose:

Returns the next available object that meets the specified condition.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Removes and returns an object on the queue.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::WaitUntilSatisfied

virtual void WaitUntilSatisfied ()

Interface Category:

API.

Purpose:

Blocks until there is an object on the queue that satisfies the condition. It does not remove the object.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::ShouldUnblockConsumer

virtual bool ShouldUnblockConsumer (const MCollectible &)

Interface Category:

API.

Purpose:

Implementors of new conditions must override this member function. It returns true if the consumer should be notified that the passed in object is the kind of object that they need.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the object meets the criteria for this condition.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::AddedElement

void AddedElement (const MCollectible &)

Interface Category:

API.

Purpose:

Called by the producer consumer queue, each time it adds a new element to its queue. The condition is given an opportunity to wake up any clients so that they can remove the object from the queue.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Generates a hash value for collection classes.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a hash value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TProducerConsumerCondition::Wait

  1. void Wait ()
  2. void Wait (const TTime & MaximumWait)

Interface Category:

API.

Purpose:

  1. Waits until the condition is satisfied.
  2. Waits until the condition is satisfied or the timeout occurs.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None

Member Function: TProducerConsumerCondition::Continue

virtual void Continue ()

Interface Category:

API.

Purpose:

Called to indicate that the condition is satisfied.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

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.