Implementing first "strategy" for proof of concept

This commit is contained in:
Michael Schimmel
2025-07-11 11:06:18 +02:00
parent 644b6074d6
commit 487169afe0
20 changed files with 1761 additions and 274 deletions
+6 -9
View File
@@ -184,12 +184,11 @@ end;
constructor TMycEvent.Create;
begin
inherited Create;
FSubscribers.Create;
end;
destructor TMycEvent.Destroy;
begin
FSubscribers.Destroy;
FSubscribers.Finalize;
inherited;
end;
@@ -202,7 +201,7 @@ function TMycEvent.Notify: Boolean;
begin
FSubscribers.Lock;
try
FSubscribers.Notify(function(Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
FSubscribers.Notify(function(const Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
finally
FSubscribers.Release;
end;
@@ -275,12 +274,11 @@ begin
inherited Create;
Assert(ACount >= 0);
FCount := ACount;
FSubscribers.Create;
end;
destructor TMycLatch.Destroy;
begin
FSubscribers.Destroy;
FSubscribers.Finalize;
inherited;
end;
@@ -300,7 +298,7 @@ begin
if shouldNotifySubscribers then
begin
FSubscribers.Notify(function(Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
FSubscribers.Notify(function(const Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
end;
// Returns true if the latch has not yet been set by this Notify call (count > 0).
@@ -395,12 +393,11 @@ constructor TMycFlag.Create(AInit: Boolean);
begin
inherited Create;
FFlag := AInit;
FSubscribers.Create;
end;
destructor TMycFlag.Destroy;
begin
FSubscribers.Destroy; // Clean up the subscriber list.
FSubscribers.Finalize;
inherited;
end;
@@ -438,7 +435,7 @@ begin
if wasPreviouslyClean then // Only notify subscribers if state changed from clean to dirty.
begin
FSubscribers.Notify(function(Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
FSubscribers.Notify(function(const Subscriber: TSignal.ISubscriber): Boolean begin Result := Subscriber.Notify; end);
end;
finally
FSubscribers.Release;