LSharedQueue is a PowerPlant class that combines a queue with a semaphore.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
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)
See also:
Purpose:
The constructor creates the object.
Access :
Prototype:
LSharedQueue();
Purpose:
The destructor destroys the LSharedQueue object.
Access :
Prototype:
virtual ~LSharedQueue();
Purpose:
Execute a user-supplied function for each element in the queue.
Access :
Prototype:
virtual void DoForEach(
LQueueIterator proc, void* arg); The parameters for this method are:
Return:
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:
sharedQueue_WaitForever Wait indefinitely (default).
sharedQueue_NoWait Do not wait. If the queue is empty, return NULL.
Prototype:
virtual LLink* Next(SInt32 milliSeconds = sharedQueue_WaitForever);Parameters:
Return:
A pointer to an LLink object.
Purpose:
Adds the given element to the end of the queue.
Access :
Prototype:
virtual void NextPut(LLink* inLinkP);Parameters:
A pointer to the LLink to put.
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 :
Prototype:
Boolean Remove(LLink* inLinkP);Parameters:
Return:
Returns a Boolean indicating if the element was found.
Purpose:
Indicates whether the data is available or not.
Access :
Prototype:
LSemaphore mAvailable;