wukenaihe / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

~ExceptionHandler() shouldn't call TerminateThread #138

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
File /src/client/windows/handler/exception_handler.cc
There is a dangerous call to TerminateThread(handler_thread_, 1); in
~ExceptionHandler that can be avoided.
In this case it's easy to just signal the thread to stop and wait until it
normally closes with WaitForSingleObject(handler_thread_, INFINITE);

cf. MSDN warning about TerminateThread
"TerminateThread is a dangerous function that should only be used in the
most extreme cases. You should call TerminateThread only if you know
exactly what the target thread is doing, and you control all of the code
that the target thread could possibly be running at the time of the
termination."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/te
rminatethread.asp

Original issue reported on code.google.com by ylenerr...@gmail.com on 22 Mar 2007 at 8:29