Re: Win32 TerminateProcess problem

Emil Dotchevski <[email protected]>
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
On Wed, Feb 3, 2010 at 6:13 PM, Jim Tilander <[email protected]> wrote:
>
> For what it is worth, TerminateProcess is a terrible thing to call. It is
> documented to leak resources, and it will have a real impact on your system
> performance, all from making it slowly slower to just making it unusable in
> a couple of minutes.

Are you sure you're not talking about TerminateThread? Could you point
me to the place in the documentation that specifies that
TerminateProcess may leak resources?

> The "best" way I'm aware of is to start a remote thread
> in the process you want to kill and call exit from that thread (which will
> allow the process cleanup to run).

This is incorrect. Exiting from a process internally calls
TerminateThread on all but the thread that calls it, thus it isn't
safer than terminating the process from the outside. In fact it is
probably less safe because you're running code in a process that's
dying, as opposed from another (healthy) process.

It's also worth pointing out that once exit is called, all thread
synchronization primitives for that process stop working properly; you
can only imagine what happens with all the shared states they were
protecting. :)

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.