On 25/09/14 17:10, 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. > > How do I kill this particular thread? Just by calling MyThread.terminate > definitely just does not work. > > Is it even possible?
There is no FPC-supplied functionality for this. In general, killing threads from an external thread is something you should never do, because you have no idea what kind of resources this may leave dangling. Terminating another thread at any point was available in early Java versions, and was removed later. It was also available in old Delphi versions and was removed later. Just don't do it. Calling "terminate" sets the "terminated" property to "true", which you can check in the run loop in the thread and make it exit itself at this (presumably safe) point. Jonas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal