For most applications, you can use a thread object to represent an execution thread in your application. Thread objects simplify writing multi-threaded applications by encapsulating the most commonly needed uses of threads.
unit Unit2; interface uses Classes; type TMyThread = class(TThread) private { Private declarations } protected procedure Execute; override; end; implementation { TMyThread } procedure TMyThread.Execute; begin { Place thread code here } end; end.
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit2.h" #pragma package(smart_init) //--------------------------------------------------------------------------- __fastcall TMyThread::TMyThread(bool CreateSuspended): TThread(CreateSuspended) { } //--------------------------------------------------------------------------- void __fastcall TMyThread::Execute() { // ---- Place thread code here ---- } //---------------------------------------------------------------------------
In the automatically generated unit file, you
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|