Work in Progress
This commit is contained in:
@@ -31,6 +31,8 @@ type
|
||||
// Returns a State to await thread completion.
|
||||
function RunTask(const Gate: TState; const Proc: TFunc<TState>): TState;
|
||||
|
||||
class function RunSequence(const Gate: TState; First, Count: Integer; const Proc: TFunc<Integer, TState>): TState; static;
|
||||
|
||||
// Waits for the operation associated with State to complete.
|
||||
// Must not be called from a task of this factory.
|
||||
// After waiting, or if the state is already set, any first stored exception
|
||||
@@ -146,6 +148,15 @@ begin
|
||||
);
|
||||
end;
|
||||
|
||||
class function TTaskManager.RunSequence(const Gate: TState; First, Count: Integer; const Proc: TFunc<Integer, TState>): TState;
|
||||
begin
|
||||
if First >= Count then
|
||||
exit;
|
||||
|
||||
var cProc: TFunc<Integer, TState> := Proc;
|
||||
Result := TaskManager.RunTask(Gate, function: TState begin Result := RunSequence(Proc(First), 1 + First, Count, cProc); end);
|
||||
end;
|
||||
|
||||
function TTaskManager.RunTask(const Gate: TState; const Proc: TFunc<TState>): TState;
|
||||
begin
|
||||
var cProc: TFunc<TState> := Proc;
|
||||
|
||||
Reference in New Issue
Block a user