Jump to content

RaelB

Members
  • Content Count

    79
  • Joined

  • Last visited

Everything posted by RaelB

  1. In the SimplePipeline project (from HL-III presentation), if I add a call to sleep in AddOne stage, the program (i.e. UI) blocks for 5 seconds. procedure AddOne(const input, output: IOmniBlockingCollection); var v: TOmniValue; begin for v in input do begin output.Add(v.AsInteger + 1); Sleep(1000); end; end; I would expect this to not block the UI, since it is running in a Thread/Task?
  2. Hello, I am looking at the code from WebSpider demo from HL-III presentation. (The project is just called pipeline) It has code like this: procedure TfrmWebSpider.UniqueFilter(const input, output: IOmniBlockingCollection); var uniqueUrls: TStringList; url : string; begin uniqueUrls := TStringList.Create; try uniqueUrls.Sorted := true; for url in input do begin if uniqueUrls.IndexOf(url) < 0 then begin uniqueUrls.Add(url); output.TryAdd(url); end else if FURLCount.Decrement = 0 then FSpider.Input.CompleteAdding; end; finally FreeAndNil(uniqueUrls); end; end; When I run the demo, I see that the uniqueUrls TStringList is working on all inputs received. This is what we want, but how does this work?, since it is a local variable one would expect/imagine that it goes out of scope each time UniqueFilter is "called". Thanks Rael
  3. Thanks, that is quite amazing. You're saying the loop is actually pausing/resuming depending on queue activity.
×