title: OmniThreadLibrary: How to run Parallel.For.Execute without using anonymous procedure?
body: <p>The Execute method of Parallel.For has a TOmniIteratorDelegate parameter. But I'm unsure on how to assign a procedure to a variable of that type. The reason for doing this is that I do not want to use anonymous procedures.</p>
  
  <p>Is this possible? If yes, can someone show me how to do it?</p>
  
  <pre><code>type
    TBookmark = record
      URL: String;
      PageTitle: String;
    end;
  
    PBookmark = ^TBookmark;
  
  var
    FBookmarkList: TThreadList&lt;PBookmark&gt;;
  
  procedure TfmMain.FormCreate(Sender: TObject);
  begin
    FBookmarkList := TThreadList&lt;PBookmark&gt;.Create;
  
  end;
  
  procedure TfmMain.FormDestroy(Sender: TObject);
  var
    B: PBookmark;
    L: TList&lt;PBookmark&gt;;
  begin
    L := FBookmarkList.LockList;
    for B in L do
      Dispose(B);
    FBookmarkList.UnlockList;
    FBookmarkList.Free;
  end;
  
  procedure SetValue(const Value: TOmniValue);
  begin
    // P := Value.ToRecord&lt;PBookmark&gt;;
    // P.PageTitle := P.URL;
  
  end;
  
  procedure TfmMain.btRefreshClick(Sender: TObject);
  var
    L: TList&lt;PBookmark&gt;;
    P: TOmniIteratorDelegate&lt;PBookmark&gt;;
    t: IOmniParallelLoop&lt;PBookmark&gt;;
  begin
  
    P := TOmniIteratorDelegate&lt;PBookmark&gt;(Addr(SetValue)); // &lt;---- Program crashes at runtime on this line!
  
    L := FBookmarkList.LockList;
    try
      t := Parallel.ForEach&lt;PBookmark&gt;(L).NumTasks(5);
      t.Execute(P);
  
      vstBkmk.Clear;
      FvstBkmkIter := 0;
      vstBkmk.RootNodeCount := L.Count;
    finally
      FBookmarkList.UnlockList;
    end;
  
  end;
  </code></pre>