 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Janwillem van Dijk Guest
|
Posted: Mon Aug 18, 2003 3:16 pm Post subject: thread deadlock |
|
|
I have a not too complex program using threads. It worked fine compiled
with Delphi6 but now I have changed to 7 and it runs into a deadlock
when the thread is ready and I call the free method. It stays in the
waitfor in TThread.destroy.
TFileReader = class(TThread)
private
FPersList: TPersList;
FPersFields: TPersfields;
FFileName: string;
FRecord_n,
FnPrint: Integer;
FOnProgress: TOnProgress;
FnBytes: Integer;
FMessage: string;
procedure DoProgress;
protected
procedure Execute; override;
public
procedure Init(const FileName: string;
const PersFields: TPersFields;
var PersList: TPersList;
const nPrint: Integer);
property PersList: TPersList read FPersList write FPersList;
property Record_n: Integer read FRecord_n write FRecord_n;
property nBytes: Integer read FnBytes write FnBytes;
property OnProgress: TOnprogress read FOnProgress write FOnProgress;
end;
..
..
..
..
procedure TFormBiGramScan.FileReaderTerminate(Sender: TObject);
var
i: Integer;
begin
ProgressBar1.Position := ProgressBar1.Max;
Record_n := TFileReader(Sender).Record_n;
PersList := FFileReader.PersList;
showmessage(IntToStr(Length(PersList)) + ' records read' + #13 +
IntToStr(Record_n + 1) + ' records selected');
SetControls(Ready);
ToolButtonReadList.down := false;
FFileReader.Free;
FFileReader := nil;
end;
(so until the statement FFileReader.Free everything works as expexted)
Can any body give me a hint where to look for the cause. I have hardly
any deeper understanding of threads etcetra.
many thanks, Janwillem
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|