This is the mail archive of the pthreads-win32@sources.redhat.com 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]

Re: pthreads comments and suggestions [was: Re: Handle leak ?]


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

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