Concurrent data processing
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user