This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: pthreads comments and suggestions [was: Re: Handle leak ?]
- To: Paul Redondo <paul at matchvision dot com>
- Subject: Re: pthreads comments and suggestions [was: Re: Handle leak ?]
- From: Ross Johnson <rpj at ise dot canberra dot edu dot au>
- Date: Mon, 24 Jul 2000 17:49:57 +1000
- CC: pthreads-win32 at sourceware dot cygnus dot com
- Organization: University of Canberra, Information Sciences and Engineering
- References: <NDBBLGLOJKFALGLAHFKAOEOGDNAA.paul@matchvision.com>
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 |
+--------------------------+