OmniThreadLibrary icon indicating copy to clipboard operation
OmniThreadLibrary copied to clipboard

Abstract Error

Open sdrissen opened this issue 9 years ago • 3 comments

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.

sdrissen avatar Oct 05 '15 12:10 sdrissen

Confirmed. I'll try to fix it soon.

gabr42 avatar Oct 05 '15 13:10 gabr42

Came across this too. I have nothing constructive to add.

micha137 avatar Mar 17 '17 12:03 micha137

Maybe this is more constructive (read it like a call stack):

  1. When the input is a TOmniBlockingCollection and Into() is used, TOmniParallelLoopBase.InternalExecuteIntoOrdered() will call localQueue.GetNext(position, value). localQueue is of type TOmniLocalQueue.

  2. Next TOmniLocalQueueImpl.GetNext(var position: int64; var value: TOmniValue) is called, which calls lqiDataPackage.GetNext(position, value) lqiDataPackage is of the class TOmniValueEnumeratorDataPackage.

  3. But TOmniValueEnumeratorDataPackage does not overwrite the abstract method TOmniDataPackage.GetNext(var position: int64; var value: TOmniValue): boolean.

micha137 avatar Mar 17 '17 12:03 micha137