Concurrent data processing

This commit is contained in:
Michael Schimmel
2025-07-13 14:20:30 +02:00
parent 9ce608ba09
commit f6fff24f10
9 changed files with 210 additions and 127 deletions
+10
View File
@@ -37,6 +37,9 @@ type
// Frees memory previously allocated for a TItem.
class procedure FreeItem(Item: PItem); static; inline;
private
function GetFirst: PItem;
public
// Initializes the list in an unlocked state.
class operator Initialize(out Dest: TMycNotifyList<T>);
@@ -58,6 +61,7 @@ type
// If the predicate returns false, the receiver is detached from further notifications
// by setting its interface reference to nil. The list item itself is not freed here.
procedure Notify(const Func: TNotifyProc);
property First: PItem read GetFirst;
end;
implementation
@@ -112,6 +116,12 @@ begin
FreeMem(Item, sizeof(TItem));
end;
function TMycNotifyList<T>.GetFirst: PItem;
begin
Assert(IsLocked);
Result := FList;
end;
function TMycNotifyList<T>.IsLocked: Boolean;
begin
Result := NativeUInt(FList) and 1 = 0;