[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LSharedQueue



Overview:

LSharedQueue is a PowerPlant class that combines a queue with a semaphore.

Methods :

The methods in this class are:

 

LSharedQueue()  
~LSharedQueue()  
DoForEach()  
Next()  
NextPut()  
Remove()  

Data Members:

The data members in this class are:

 

mAvailable  
 

Operation:

By combining a queue with a semaphore, you can protect the data in the queue. This allows two or more threads to share a common data queue.

Source files:

(_Advanced Classes:Threads Classes)

LSharedQueue.h

LSharedQueue.cp

See also:

LMutexSemaphore

LSemaphore

LQueue

LSharedQueue()

Purpose:

The constructor creates the object.

Access :

Public

Prototype:

LSharedQueue();

~LSharedQueue()

Purpose:

The destructor destroys the LSharedQueue object.

Access :

Virtual, Public

Prototype:

virtual ~LSharedQueue();

DoForEach()

Purpose:

Execute a user-supplied function for each element in the queue.

Access :

Virtual, Public

Prototype:

virtual void DoForEach(
  LQueueIterator proc, void* arg);
Parameters:

The parameters for this method are:

 

LQueueIterator  
proc  
The queue iterator.  
void*  
arg  
The function to perform.  

Return:

None

Next()

Purpose:

Removes and returns the first element in the queue. milliSeconds is an optional argument which specifies how long the caller is willing to wait for an element. Possible values are:

Virtual, Public

Prototype:

virtual LLink* Next(SInt32 milliSeconds = 
sharedQueue_WaitForever);
Parameters:

The number of msec to wait.

Return:

A pointer to an LLink object.

NextPut()

Purpose:

Adds the given element to the end of the queue.

Access :

Virtual, Public

Prototype:

virtual void NextPut(LLink* inLinkP);
Parameters:

A pointer to the LLink to put.

Remove()

Purpose:

Remove an arbitrary element from the queue. This function traverses the entire queue, looking for the given queue element. If the element is found, it is removed from the queue.

Access :

Virtual, Public

Prototype:

Boolean Remove(LLink* inLinkP);
Parameters:

None

Return:

Returns a Boolean indicating if the element was found.

mAvailable

Purpose:

Indicates whether the data is available or not.

Access :

Protected

Prototype:

LSemaphore mAvailable;

[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000