pthreads comments and suggestions [was: Re: Handle leak ?]
Ross Johnson
rpj@ise.canberra.edu.au
Mon Jul 24 00:50:00 GMT 2000
Paul Redondo wrote:
>
> > I got this same reaction when I notified this list about the bug
> > before: nobody believed there was a bug. TRY IT.
>
> I do confirm. There IS a bug. I'm gonna try your fix (the null testing), and
> relaunch the whole test (creation of detached threads during 24 hours).
David Baggett is currently testing another patch, this time in
pthread_create().
The theory is that _beginthreadex() should start threads suspended
so that the HANDLE it returns can be assigned to thread-threadH
before the thread gets too far or ends (if it's a very short thread).
Seems obvious now, but ...
That is, the patch below:
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 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