TThreadList

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Thread-safe list object

Declaration

Source position: classesh.inc line 353

Type
  TThreadList = class
  private
    FList : TList;
    FDuplicates : TDuplicates;
    FLock : TRTLCRITICALSECTION;
  public
    constructor Create;
    destructor Destroy;  Override;
    procedure Add(Item: Pointer);
    procedure Clear;
    function LockList : TList;
    procedure Remove(Item: Pointer);
    procedure UnlockList;
    Duplicates : TDuplicates;
  end
  ;

Description

TThreadList is a thread-safe Tlist implementation. Unlike TList, it can be accessed read-write by multiple threads: the list implementation will take care of locking the list when adding or removing items from the list.

Members

Member Type Visibility Description
Add Method public Adds an element to the list.
Clear Method public Removes all elements from the list.
Create Method public Creates a new thread-safe list.
Destroy Method public Destroys the list instance.
Duplicates Property public Describes what to do with duplicates
FDuplicates Field private
FList Field private
FLock Field private
LockList Method public Locks the list for exclusive access.
Remove Method public Removes an item from the list.
UnlockList Method public Unlocks the list after it was locked.

Inheritance

Class Description
TThreadList Thread-safe list object

See also

Name Description
TDuplicates Type to describe what to do with duplicate values in a TStringlist .
TDuplicates Type to describe what to do with duplicate values in a TStringlist .
TList Class to manage collections of pointers.
TList Class to manage collections of pointers.
TRTLCRITICALSECTION A class for managing multiple threads