Chris, and devs, I'm confused;
the thd->td handle *is* closed in apr_thread_join. If we deploy this patch
to accomodate a particular programming style, we lose valuable return context
information, but more importantly, if you aren't invoking apr_thread_join, then
on many flavors of *nix you aren't farming the zombie threads.
Note we also properly close thd->td within apr_thread_detach, for much the
same reasons one or the other must be invoked on *nix.
This patch is problematic for me; anyone else have some thoughts to share?
Bill
Chris Storah wrote:
Enclosed is a patch to fix a leak in APR threads, due to _endthreadex
not automatically closing the handle (unlike _endthread).
Chris
------------------------------------------------------------------------
--- thread.c 2005-12-30 15:44:05.000000000 +1100
+++ thread.c.orig 2005-12-29 10:05:45.000000000 +1100
@@ -137,10 +137,6 @@
apr_pool_destroy(thd->pool);
thd->pool = NULL;
#ifndef _WIN32_WCE
- /* need to close the handle as _endthreadex does not automatically
- * do this - unlike _endthread
- */
- CloseHandle(thd->td);
_endthreadex(0);
#else
ExitThread(0);