This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Fwd: Handle leak ?]

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:

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 *))
                   (unsigned) CREATE_SUSPENDED,
                   (unsigned *) &(thread->thread));

 if (thread->threadH != (HANDLE) 0 && run)


| Ross Johnson         |   | E-Mail:
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:
| AUSTRALIA                |

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]