[fpc-pascal] is it possible to kill a thread from within fpc?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Sep 25 19:31:51 CEST 2014


Dennis Poon wrote:
> I want to kill a thread created by my fpc program (not killing the 
> entire process).
> I have to use an external win32 dll.
> I am already calling it from a separate thread but still, that dll 
> something goes into an infinite loop  which made my thread freezes.

Are you absolutely sure that the loop is a coding error in the DLL, or 
is there any possibility that it's either because you're not calling it 
properly, because you've not initialised something properly, or because 
you're mistakenly allocating memory using a heap manager in the DLL and 
then releasing it in the main program or vice-versa?

Noting everything that Jonas has said, and pointing out that there's 
been extensive discussion in the past relating to even calling  Suspend 
  from inside the thread's own code, I'd point out that it's fairly 
common practice for programs such as Firefox to launch a separate 
process (not thread) to handle e.g. an instance of the Flash player. Is 
this something you could do, or do you have to have fine-grained control 
of multiple subroutines in the DLL?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list