BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

thread deadlock

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Upgrade
View previous topic :: View next topic  
Author Message
Janwillem van Dijk
Guest





PostPosted: Mon Aug 18, 2003 3:16 pm    Post subject: thread deadlock Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Upgrade All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.