This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
[Fwd: Handle leak ?]
- To: pthreads-win32 at sourceware dot cygnus dot com
- Subject: [Fwd: Handle leak ?]
- From: Ross Johnson <rpj at ise dot canberra dot edu dot au>
- Date: Mon, 31 Jul 2000 16:50:20 +1000
- Organization: University of Canberra, Information Sciences and Engineering
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 |
+--------------------------+