 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Aug 18, 2005 3:20 pm Post subject: multithreaded exe -> dll = problems terminating threads |
|
|
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
|
Posted: Sat Aug 20, 2005 1:05 pm Post subject: Re: multithreaded exe -> dll = problems terminating threads |
|
|
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 |
|
 |
|
|
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
|
|