Mark Morgan Lloyd wrote:
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?


It am quite sure it is the dll's problem because the problem happens at 11pm everyday only. Nothing in my program has anything related to that time. The dll is a brokerage firm's order placing system. 11pm is when the market closes so probably the dll has something done at that time that loops forever. Using a separate process to call it is possible but exchanging data between my program and that process will slow down entire communication and time sensitivity is required for online trading program. The supplier of the dll is quite irresponsive to questions or bug report.
Anyway, thanks for all your comments.

Dennis
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to