L
lixiaohui
Unregistered / Unconfirmed
GUEST, unregistred user!
constructor TSendThread.Create(myclass:TObject);
begin
FQry := TADOQuery.Create(nil);
FQryTmp := TADOQuery.Create(nil);
FQryTmp1 := TADOQuery.Create(nil);
FQryTmp.Connection := frmmain.con ;
FQryTmp1.Connection := frmmain.con;
FQry.Connection := frmmain.con;
EnterCriticalSection(CS);
inc(NowThreadNum);
LeaveCriticalSection(CS);
tmpSmsRecordObj:=string(myclass);
inherited Create(false);
end;
destructor TSendThread.Destroy;
begin
FQry.Close;
FQry.Free;
FQryTmp.Free;
FQryTmp1.Free;
EnterCriticalSection(CS);
dec(NowThreadNum);
if NowThreadNum<0 then
NowThreadNum:=0;
LeaveCriticalSection(CS);
waitfor;
inherited;
end;
procedure TSendThread.Execute;
begin
inherited;
FreeOnTerminate:=true;
StartExecute;
end;
begin
FQry := TADOQuery.Create(nil);
FQryTmp := TADOQuery.Create(nil);
FQryTmp1 := TADOQuery.Create(nil);
FQryTmp.Connection := frmmain.con ;
FQryTmp1.Connection := frmmain.con;
FQry.Connection := frmmain.con;
EnterCriticalSection(CS);
inc(NowThreadNum);
LeaveCriticalSection(CS);
tmpSmsRecordObj:=string(myclass);
inherited Create(false);
end;
destructor TSendThread.Destroy;
begin
FQry.Close;
FQry.Free;
FQryTmp.Free;
FQryTmp1.Free;
EnterCriticalSection(CS);
dec(NowThreadNum);
if NowThreadNum<0 then
NowThreadNum:=0;
LeaveCriticalSection(CS);
waitfor;
inherited;
end;
procedure TSendThread.Execute;
begin
inherited;
FreeOnTerminate:=true;
StartExecute;
end;