I have Delphi application on windows XP. This application works with 100 threads. At some cases i have to terminate thread with fully drops of thread’s stack.
I looking for function from WinAPI like terminatethread but it not safelly and:
Windows Server 2003 and Windows XP/2000: The target thread’s initial stack is not freed, causing a resource leak.
There’s no such function. No such function could possibly exist. Windows cannot possibly know which resources are to be tidied up by that thread, and it couldn’t know how to do so. That is the responsibilty of your app.
It sounds to me like your are going about this the wrong way. You ought to be terminating the thread in a co-operative fashion without using force. Anything else is bound to lead to leaks and most likely other more serious problems.