TLazThreadedQueue class
Implements a thread-safe FIFO queue for items of a generic type.
Declaration
TLazThreadedQueue<T> = classDescription
TLazThreadedQueue is generic class which implements a thread-safe
FIFO queue using a generic type for its items. The class requires
specialization to specify the type stored in the items for the queue. For
example:
TLazThreadedQueueString = specialize TLazThreadedQueue<String>; TLazThreadedQueueInt = specialize TLazThreadedQueue<Integer>; TLazThreadedQueueRect = specialize TLazThreadedQueue<TRectangle>;
TLazThreadedQueue uses an internal
TLazMonitor member
to synchronize access to resources in the queue between executing threads.
Methods in the class which require thread-safe access use the monitor to
enable/disable resource protection. Items in the queue are maintained using
the
PushItem,
PopItem, and
PopItemTimeout
methods. Properties are provided to determine the size of the queue, and the
number of items added or removed.
TLazThreadedQueue specializations are used in the implementation of the
fpdserver component, and its integration into the Lazarus IDE.
See also
Properties
FifoQueue | protected | Provides access to the TLazTypedFifoQueue instance used in the class. |
QueueSize | public | Number of storage slots for items in the queue. |
TotalItemsPopped | public | Total number of items removed from the queue. |
TotalItemsPushed | public | Total number of items added to the queue. |
ShutDown | public | Indicates if the DoShutdown method has been called but not finished. |
Methods
TryPushItemUnprotected | protected | Tries to push an item onto the queue without resource protection. |
TryPopItemUnprotected | protected | Tries to pop an item off of the queue without resource protection. |
Lock | protected | Enters the Monitor used for resource protection. |
Unlock | protected | Leaves the Monitor used for resource protection. |
CreateFifoQueue | protected | Creates the TLazTypedFifoQueue instance used in the class. |
create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Grow | public | Expands (or shrinks) the allocated storage for the queue by the specified size. |
PushItem | public | Adds the specified item to the queue. |
PopItem | public | Pops the next item from the queue. |
PopItemTimeout | public | Pops an item off the queue with a timeout value. |
DoShutDown | public | Performs actions required when the thread-safe queue is freed. |
Types and constants
TLazTypedFifoQueue | protected | Type used to the specialize the internal TLazFifoQueue instance for the class. |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
