TWaitableQueue
A queue that can be waited on
Inheritance
Level | Ancestor | Description |
---|---|---|
1 | TObject | Ultimate ancestor in a class hierarchy |
2 | TWaitableObject | Ahstract base class for an object that can be waited for using WaitFor |
3 | TWaitableQueue |
Source
Thread.Synchronization.WaitableQueue.pas (34)
Description
A TWaitableQueue
can be used by multiple threads to safely Queue
elements at the end of the queue
and Dequeue
from the front of the queue. Use WaitFor
to postpone execution until the queue is not empty
and a call to Dequeue
will succeed. The queue can either have a finite maximum size or not. When there is a maximum size
every call to Queue
will block when the queue is full until a element is dequeued.
Fields
Scope | Visibility | Type | Name | Description |
---|---|---|---|---|
Instance | protected | TThreadLock | Lock | |
Instance | protected | TList<TElement> | Elements | |
Instance | protected | TSemaphore | EmptySemaphore | |
Instance | protected | TSemaphore | Semaphore |
Methods
Scope | Visibility | Result | Name | Description |
---|---|---|---|---|
Instance | private | TReferenceManager<TElement> | GetElementManager() | |
Instance | private | SetElementManager(Value: TReferenceManager<TElement>) | ||
Instance | public | Create(MaximumSize: TInteger32) | ||
Instance | public | Destroy() | ||
Instance | public | THandle | GetWaitHandle() | |
Instance | public | TInteger32 | Queue(Element: TElement) | |
Instance | public | TElement | Dequeue(Release: TBoolean) |