apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: apr/threadproc/win32 thread.c
Date Thu, 22 Aug 2002 23:29:02 GMT
ianh        2002/08/22 16:29:01

  Modified:    .        CHANGES
               threadproc/win32 thread.c
  Log:
  Excerpt from MSVC help;
  "Like the Win32 ExitThread API, _endthreadex does not close the thread handle.
  Therefore, when you use _beginthreadex and _endthreadex,
  you must close the thread handle by calling the Win32 CloseHandle API."
  
  SUZUKI Rintaro <suzuki@ariel-networks.com> wrote the patch.
  
  Thanks.
  - INOUE Seiichiro <inoue@ariel-networks.com>
  
  Obtained from:  SUZUKI Rintaro  <suzuki@ariel-networks.com>
  Submitted by:	INOUE Seiichiro <inoue@ariel-networks.com>
  Reviewed by:	Will Rowe
  
  Revision  Changes    Path
  1.324     +2 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.323
  retrieving revision 1.324
  diff -u -r1.323 -r1.324
  --- CHANGES	22 Aug 2002 20:34:16 -0000	1.323
  +++ CHANGES	22 Aug 2002 23:29:01 -0000	1.324
  @@ -1,4 +1,6 @@
   Changes with APR 0.9.0
  +  *) handle leak related to threads on Windows2000/XP 
  +     [INOUE Seiichiro <inoue@ariel-networks.com>]
   
     *) Includes moved to INCLUDEDIR/apr-{major} (e.g. /usr/include/apr-0)
        [Greg Stein]
  
  
  
  1.48      +6 -1      apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/thread.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- thread.c	19 Mar 2002 17:54:00 -0000	1.47
  +++ thread.c	22 Aug 2002 23:29:01 -0000	1.48
  @@ -138,6 +138,7 @@
   #endif
       if (attr && attr->detach) {
           CloseHandle((*new)->td);
  +        (*new)->td = NULL;
       }
   
       return APR_SUCCESS;
  @@ -149,6 +150,9 @@
       thd->exitval = retval;
       apr_pool_destroy(thd->pool);
   #ifndef _WIN32_WCE
  +    if (thd->td) {
  +        CloseHandle(thd->td);
  +    }
       _endthreadex(0);
   #else
       ExitThread(0);
  @@ -172,7 +176,8 @@
   
   APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
   {
  -    if (CloseHandle(thd->td)) {
  +    if (thd->td && CloseHandle(thd->td)) {
  +        thd->td = NULL;
           return APR_SUCCESS;
       }
       else {
  
  
  

Mime
View raw message