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 

multithreaded exe -> dll = problems terminating threads

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Aug 18, 2005 3:20 pm    Post subject: multithreaded exe -> dll = problems terminating threads Reply with quote



Hi all!
When using below code in an application (.exe) it works fine, but
moving it to a .DLL, the SillyThread wont terminate if i put some
breakpoints in the thread and/or in the mainthread. Any ideas on this
appreciated





unit Unit1;

interface

implementation

uses
Classes, SysUtils, SyncObjs;

type
TSillyThread = class(TThread)
protected
procedure Execute; override;
public
SimpleEvent: TSimpleEvent;

constructor Create;
destructor Destroy; override;
end;

var
SillyThread: TSillyThread;
{ TSillyThread }

constructor TSillyThread.Create;
begin
inherited Create(True);
SimpleEvent := TSimpleEvent.Create;
Resume;
end;

destructor TSillyThread.Destroy;
const
INFINITY = $FFFFFFFF;
begin
Terminate;
//WaitFor; //Does not work. Seams to require a messageloop which
there are none in a DLL
SimpleEvent.WaitFor(INFINITY);
SimpleEvent.Free;

inherited Destroy;
end;

procedure TSillyThread.Execute;
begin
while not Terminated do
Sleep(1000);
SimpleEvent.SetEvent;
end;

initialization
SillyThread := TSillyThread.Create;
finalization
SillyThread.Free;
end.
Back to top
Riki Wiki
Guest





PostPosted: Sat Aug 20, 2005 1:05 pm    Post subject: Re: multithreaded exe -> dll = problems terminating threads Reply with quote



On 18 Aug 2005 04:20:44 -0700, jonsjostedt (AT) hotmail (DOT) com wrote:

Quote:
Any ideas on this appreciated

Hoi Jon

Take a look here:
http://delphi.wikicities.com/wiki/Delphi_Newsgroups

And further, please do not multi post.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal 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.