[Fwd: Handle leak ?]

Ross Johnson rpj@ise.canberra.edu.au
Sun Jul 30 23:52:00 GMT 2000


There will be a new snapshot available in the next few days which
will include the following patch in create.c:pthread_create().

This patch fixes the handle leak reported by David Baggett and
Paul Redondo.

Thanks go to Eyal Lebedinsky who spotted the root cause
and David Baggett for testing it:

Explanation
-----------
When threads were being started as "running", short
threads would sometimes reach the cleanup code in
_pthread_threadDestroy() before _beginthreadex returned with the
Win32 thread handle; ie. thread->threadH would be NULL and the
handle would never get closed.


 thread->threadH = (HANDLE)
   _beginthreadex (
                   (void *) NULL,     /* No security info */
                   (unsigned) stackSize,    /* default stack size */
                   (unsigned (PT_STDCALL *) (void *))
_pthread_threadStart,
                   parms,
                   (unsigned) CREATE_SUSPENDED,
                   (unsigned *) &(thread->thread));

 if (thread->threadH != (HANDLE) 0 && run)
   {
      ResumeThread(thread->threadH);
   }


Ross

-- 
+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+


More information about the Pthreads-win32 mailing list