OmniThreadLibrary
OmniThreadLibrary copied to clipboard
Abstract Error
procedure TForm1.FormCreate(Sender: TObject); var LLoop: IOmniParallelLoop<TOmniValue>; LInput: IOmniBlockingCollection; LOutput: IOmniBlockingCollection; begin LInput := TOmniBlockingCollection.Create; LOutput := TOmniBlockingCollection.Create;
LLoop := Parallel.ForEach<TOmniValue>(LInput); LLoop.PreserveOrder .NoWait .Into(LOutput) .Execute(procedure (const value: TOmniValue; var res: TOmniValue) begin res := value end); end;
It is not possible to perserve the order (.Into), when the input is TOmniBlockingCollection.
Confirmed. I'll try to fix it soon.
Came across this too. I have nothing constructive to add.
Maybe this is more constructive (read it like a call stack):
-
When the input is a TOmniBlockingCollection and Into() is used, TOmniParallelLoopBase.InternalExecuteIntoOrdered() will call localQueue.GetNext(position, value). localQueue is of type TOmniLocalQueue.
-
Next TOmniLocalQueueImpl.GetNext(var position: int64; var value: TOmniValue) is called, which calls lqiDataPackage.GetNext(position, value) lqiDataPackage is of the class TOmniValueEnumeratorDataPackage.
-
But TOmniValueEnumeratorDataPackage does not overwrite the abstract method TOmniDataPackage.GetNext(var position: int64; var value: TOmniValue): boolean.