embedded linux ,android

2010年11月16日 星期二

BCB thread

解ATE bug
thread跑完就結束了,不需要delete


unit2.h
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
//---------------------------------------------------------------------------
class TGridThread1 : public TThread
{
protected:
        void __fastcall Execute();
public:
        __fastcall TGridThread1(bool CreateSuspended);
};
//---------------------------------------------------------------------------
#endif
unit2.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#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);
//
//   where UpdateCaption could look like:
//
//      void __fastcall TGridThread1::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------

__fastcall TGridThread1::TGridThread1(bool CreateSuspended)
        : TThread(CreateSuspended)
{
}
void __fastcall TGridThread1::Execute()
{
        //---- Place thread code here ----
}
uint1.cpp
#include 
#pragma hdrstop

#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CGAUGES"
#pragma resource "*.dfm"
TForm1 *Form1;
TGridThread1 *GridThread1;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
    // Create the thread objects
    GridThread1 = new TGridThread1(true);

    // Initial setup for threads and buttons
    GridThread1->Resume();
}

沒有留言:

張貼留言