Concurrent DataStream-Chunks
This commit is contained in:
@@ -62,7 +62,7 @@ type
|
||||
|
||||
function ProcessChunks(
|
||||
const DataChunks: TArray<TArray<TDataPoint<T>>>;
|
||||
const Terminated: TState;
|
||||
Terminated: TState;
|
||||
Processor: IMycProcessor<TArray<TDataPoint<T>>>
|
||||
): TState;
|
||||
|
||||
@@ -362,19 +362,28 @@ end;
|
||||
|
||||
function TAuraDataServer<T>.ProcessChunks(
|
||||
const DataChunks: TArray<TArray<TDataPoint<T>>>;
|
||||
const Terminated: TState;
|
||||
Terminated: TState;
|
||||
Processor: IMycProcessor<TArray<TDataPoint<T>>>
|
||||
): TState;
|
||||
begin
|
||||
var done := TLatch.CreateLatch(Length(DataChunks));
|
||||
var callProcess :=
|
||||
function(Idx: Integer): TFunc<TState>
|
||||
begin
|
||||
var cChunk := DataChunks[Idx];
|
||||
Result :=
|
||||
function: TState
|
||||
begin
|
||||
if not Terminated.IsSet then
|
||||
Result := Processor.ProcessData(cChunk);
|
||||
end;
|
||||
end;
|
||||
|
||||
for var i := 0 to High(DataChunks) do
|
||||
if not Terminated.IsSet then
|
||||
Processor.ProcessData(DataChunks[i]).Signal.Subscribe(done)
|
||||
else
|
||||
done.Notify;
|
||||
|
||||
Result := done.State;
|
||||
begin
|
||||
var q := TaskManager.RunTask(Result, callProcess(i));
|
||||
Result := q;
|
||||
end
|
||||
end;
|
||||
|
||||
function TAuraDataServer<T>.ProcessFile(
|
||||
|
||||
Reference in New Issue
Block a user