NamedThread (Delphi)
Description
The following code is exactly the code generated when you create a named thread with the thread wizard.
Code
type
TMyThread = class(TThread)
protected
procedure Execute; override;
end;
implementation
{
Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example:
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TMyThread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TMyThread }
procedure TMyThread.Execute;
begin
NameThreadForDebugging('My Cool Thread');
{ Place thread code here }
Sleep(5000);
end;