While we’re talking things Parallel, the other part of the same demo from last post showed spawning a single task that slept for awhile and then called ShowMessage.
1 2 3 4 5 6 7 8 9 10 11 12 |
procedure TFormThreading.Button1Click(Sender: TObject); var aTask: ITask; begin // not a thread safe snippet aTask := TTask.Create(procedure begin sleep(3000); ShowMessage('Hello'); end); aTask.Start; end; |
Note the comment. Read On…