[1.7] pthread_create block

Dave Korn dave.korn.cygwin@googlemail.com
Tue Jun 2 10:11:00 GMT 2009


Thomas Stalder wrote:

> Sometimes pthread_create block and never return.
> 
> I have made a simple program (test.c) to reproduce the problem.
> 
>> gcc test.c -lpthread -o test
>> ./test
> thread id=1
> thread id=2
> thread id=3
> thread id=4
> ........
> thread id=3736
> 
> 
> Sometimes pthread_create block after creating arround 10 threads,
> sometimes after creating arround 10000 threads or more.

  You may have run into the pthread interlocking bug that I'm tracking down in
this thread on the cygwin-dev list:

    http://www.cygwin.com/ml/cygwin-developers/2009-05/threads.html#00084

  If you'd like to try building the cygwin DLL yourself from the CVS sources
with the attached patch applied, you may find it solves your problem; at least
for me it does.  I've been running your test program while writing this email
and it's got as far as this:

thread id=1260546
thread id=1260547

... without a hiccup.  Actually, now it's got as far as

thread id=2405875

by the time I diff'd the patch for you.  (If you'd prefer, I could send you a
binary of the DLL built with the patch, off-list; let me know).

    cheers,
      DaveK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asm-interlock.diff
Type: text/x-c
Size: 1130 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090602/0a0d2dc3/attachment.bin>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list