[Overview][Types][Classes][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Implements a thread-safe FIFO queue for items of a generic type.
Source position: lazcollections.pas line 82
type generic TLazThreadedQueue <T>= class |
||
protected |
||
Type |
||
|
Type used to the specialize the internal TLazFifoQueue instance for the class. |
|
function TryPushItemUnprotected(); |
|
Tries to push an item onto the queue without resource protection. |
function TryPopItemUnprotected(); |
|
Tries to pop an item off of the queue without resource protection. |
procedure Lock; |
|
Enters the Monitor used for resource protection. |
procedure Unlock; |
|
Leaves the Monitor used for resource protection. |
function CreateFifoQueue(); virtual; |
|
Creates the TLazTypedFifoQueue instance used in the class. |
property FifoQueue: TLazTypedFifoQueue; [r] |
|
Provides access to the TLazTypedFifoQueue instance used in the class. |
public |
||
constructor create(); |
|
Constructor for the class instance. |
destructor Destroy; override; |
|
Destructor for the class instance. |
procedure Grow(); |
|
Expands (or shrinks) the allocated storage for the queue by the specified size. |
function PushItem(); |
|
Adds the specified item to the queue. |
function PopItem(); |
|
Pops the next item from the queue. |
function PopItemTimeout(); |
|
Pops an item off the queue with a timeout value. |
procedure DoShutDown; |
|
Performs actions required when the thread-safe queue is freed. |
|
Number of storage slots for items in the queue. |
|
property TotalItemsPopped: QWord; [r] |
|
Total number of items removed from the queue. |
property TotalItemsPushed: QWord; [r] |
|
Total number of items added to the queue. |
property ShutDown: Boolean; [r] |
|
Indicates if the DoShutdown method has been called but not finished. |
end; |
|
Implements a thread-safe FIFO queue for items of a generic type. |
|
| | ||
TObject |
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.
|
Implements a synchronization construct which provides thread-safe access to resources. |
Version 4.0 | Generated 2025-05-03 | Home |