Вниз
Скачать: CL | DM;

Вопрос по Thread, мож кто прояснит в чём дело...   Найти похожие ветки 

 
_Agent_   (2003-11-04 17:16) [0]

создаю Ветвь..
type
TScanThr = class(TThread)
DBFQuery:TQuery;
SQLStorPr:TStoredProc;
protected
procedure Execute; override;
public
constructor Create(........);
destructor Destroy; override;
end;

implementation
constructor TScanThr.Create ( ......);
begin
inherited Create(True);
FreeOnTerminate :=True;
DBFQuery:=TQuery.Create(nil);
.......
SQLStorPr:=TStoredProc.Create(nil);
.......
Resume;
end;

procedure TScanThr.Execute;
begin
..........
end;

destructor TScanThr.Destroy;
begin
if Assigned(DBFQuery) then
begin
DBFQuery.Close;
DBFQuery.Free;
DBFQuery := nil;
end;
if Assigned(SQLStorPr) then
begin
SQLStorPr.Close;
SQLStorPr.Free;
SQLStorPr := nil;
end;
inherited;
end;
спервого раза всё отрабатывает нормально и destructor тоже.
далее если из основного потока вызвать
If not Assigned( ScanThr)then (где ScanThr:TScanThr)
begin
//действия повторно не выполняются
end;
мож я как то не так удаляю ветвь в деструкторе
Заранее благодарен..


 
Игорь Шевченко ©   (2003-11-04 17:33) [1]

После деструктора переменная ScanThr не обнуляется. Отладчиком надо пользоваться вообще-то...


 
Chlavik ©   (2003-11-04 17:40) [2]


..
ScanThr:=TScanThr.Create......
ScanThr.OnTerminate:=ScanThrTerminate;
..

procedure Form1.SQLStorPrTerminate(Sender:TObject);
begin
ScanThr:=nil;
end;


 
_Agent_   (2003-11-04 18:00) [3]

Спасибо большое.....
P.S. Век живи, век учись .... и дальше что то про дурака и смерть :)))



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.024 c
3-40906
Guerrillero
2003-10-19 23:44
2003.11.13
Создание таблиц в InterBase


3-41098
AlexGreG
2003-10-21 11:47
2003.11.13
... FAST REPORT и рисунки в отчётах ...


3-40785
viper_cd
2003-10-24 21:38
2003.11.13
InterBase


4-42227
DNT
2003-09-01 18:25
2003.11.13
Помогите получить пути к открытым файлам.


14-42053
Sergo
2003-10-24 09:39
2003.11.13
Теория алгоритмов




   Наверх