NamedThread (C++)
Description
The following code is the same one generated when you create a named thread with the thread wizard.
Code
#include "Unit2.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(&UpdateCaption);
//
// Here, UpdateCaption could look like:
//
// void __fastcall TMyThread::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall TMyThread::TMyThread(bool CreateSuspended)
: TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
void __fastcall TMyThread::Execute()
{
TThread::NameThreadForDebugging("My Cool Thread");
Sleep(5000);
//---- Place thread code here ----
}