Thread View: borland.public.delphi.language.objectpascal
2 messages
2 total messages
Started by jonsjostedt
Thu, 18 Aug 2005 11:20
multithreaded exe -> dll = problems terminating threads
Author: jonsjostedt
Date: Thu, 18 Aug 2005 11:20
Date: Thu, 18 Aug 2005 11:20
66 lines
2185 bytes
2185 bytes
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.
Re: multithreaded exe -> dll = problems terminating threads
Author: Riki Wiki
Date: Sat, 20 Aug 2005 09:05
Date: Sat, 20 Aug 2005 09:05
10 lines
1054 bytes
1054 bytes
On 18 Aug 2005 04:20:44 -0700, jonsjostedt@hotmail.com wrote: > 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads