Fixed concurrent processing

This commit is contained in:
Michael Schimmel
2025-07-16 14:12:07 +02:00
parent bc75f08477
commit 342eb07c42
8 changed files with 192 additions and 105 deletions
+19 -1
View File
@@ -29,7 +29,10 @@ type
// Run a task when the gate is opened.
// Returns a State to await thread completion.
function RunTask(const Gate: TState; const Proc: TFunc<TState>): TState;
function RunTask(const Proc: TFunc<TState>): TState; overload;
function RunTask(const Gate: TState; const Proc: TFunc<TState>): TState; overload;
procedure RunTask(const Gate: TState; const Proc: TProc); overload;
procedure RunTask(const Proc: TProc); overload;
class function RunSequence(const Gate: TState; First, Count: Integer; const Proc: TFunc<Integer, TState>): TState; static;
@@ -181,6 +184,21 @@ begin
);
end;
function TTaskManager.RunTask(const Proc: TFunc<TState>): TState;
begin
Result := RunTask(TState.Null, Proc);
end;
procedure TTaskManager.RunTask(const Proc: TProc);
begin
RunTask(TState.Null, Proc);
end;
procedure TTaskManager.RunTask(const Gate: TState; const Proc: TProc);
begin
FTaskManager.RunTask(Gate, Proc);
end;
procedure TTaskManager.WaitFor(const State: TState);
begin
FTaskManager.WaitFor(State);