title: Main thread blocking parallel thread?
body: <p>Create a VCL Forms Application, put a TButton and a TMemo on the Form, and write this code in the button's OnClick handler:</p>
  
  <pre><code>uses
    OtlParallel, OtlTaskControl;
  
  procedure TForm2.btnStartLoopClick(Sender: TObject);
  var
    starttime: Cardinal;
    k: Integer;
  begin
    mmoTest.Lines.Clear;
    for k := 1 to 50 do
      mmoTest.Lines.Add('Line ' + IntToStr(k));
  
    starttime := GetTickCount;
    Parallel.Async(
      procedure
      var
        i: Integer;
      begin
        for i := 1 to 50 do
        begin
          Sleep(100);
          mmoTest.Lines[i - 1] := mmoTest.Lines[i - 1] + FormatDateTime(' nn:ss:zzz', Now);
        end;
      end,
      Parallel.TaskConfig.SetPriority(TOTLThreadPriority.tpHighest).OnTerminated(
      procedure
      begin
        mmoTest.Lines.Add(IntToStr(GetTickCount - starttime) + ' milliseconds');
      end));
  end;
  </code></pre>
  
  <p>Now run the program and make this test:</p>
  
  <ol>
  <li><p>Click on the button, simply wait for the loop to complete and look at the time displayed in the last line of the memo: It should be approximately 5300 milliseconds.</p></li>
  <li><p>Now click again on the button, click and hold the form's title bar and move the form around quickly until the loop has finished. Now look again at the memo's last line: In my tests, the time was over 7000 milliseconds. Obviously, the main thread is blocking the parallel thread!</p></li>
  </ol>
  
  <p>So how can the main thread blocking the parallel thread be avoided?</p>