Solved in 10.1 Berlin

Solved in 10.1 Berlin
https://quality.embarcadero.com/browse/RSP-12451

Well, solved is a strong word for a simple Works as expected and a comment

"Cancellation is a special case"

I am very impressed of this solution*

Maybe we will see an updated documentation at
http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Threading.TTask.WaitForAll

Warning If you are going to cancel a task please think twice, because it is a special case and we did not respect this for "TTask.WaitForAll". Maybe we will rename this in "TTask.WaitForAllNotCanceled". When you want to cancel why do you want to start the task?

OMG

* = ironic flag
https://quality.embarcadero.com/browse/RSP-12451

Comments

  1. Oliver Münzberg OK. So the problem is you Wait for the task and it still hasn't handled the cancellation request (that is, it isn't in the Canceled state yet)? It might not be what all developers expect, but it might be how it was designed....

    ReplyDelete
  2. Marco Cantù Maybe you will understand the cancellation when you look at the old known TThread.

    procedure TMyThread.Execute;
    begin
    inherited;
    while not Terminated do
    begin
    Sleep( 5000 );
    end;
    end;

    If you terminate the thread, the thread is terminated but not finished. It is finished, when the Execute method has left.

    So Terminated is also a wish and Finished is a fact.

    ReplyDelete
  3. Sure, I know about TThread, and have some good ideas about TTask.

    ReplyDelete

Post a Comment