public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* [Fwd: Handle leak ?]
@ 2000-07-30 23:52 Ross Johnson
  0 siblings, 0 replies; only message in thread
From: Ross Johnson @ 2000-07-30 23:52 UTC (permalink / raw)
  To: pthreads-win32

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                |
+--------------------------+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-30 23:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-30 23:52 [Fwd: Handle leak ?] Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).