This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.5.24-2: pthreads rwlock recursive acquisition failing


On Oct  1 13:44, Gabriel Landau wrote:
> Forgot attachments.  Here they are, sorry.
>
> - Gabriel Landau
>
> Gabriel Landau wrote:
>> Hello,
>> I'm trying to develop a program that uses pthreads and needs to 
>> recursively acquire RO rwlocks and RW rwlocks.  I'm not upgrading or 
>> trying to acquire an RO lock after an RW lock has been acquired, yet 
>> pthread_rwlock_rdlock() keeps returning EDEADLK.  I have tested the 
>> attached test program (includes at top modified slightly) on Ubuntu Linux 
>> and it has no recursion problem.
>> I'm using Windows Vista (copied cygwin dir from a valid XP install), but 
>> my friend can reproduce the problem on his Windows XP machine just as 
>> reliably.
>> I've attached an application that demonstrates this bug.  You can build it 
>> with: gcc -o cygwin-pthread-bug.exe cygwin-pthread-bug.c
>> Much less importantly, pthread_rwlockattr_setpshared(&lkattr, 
>> PTHREAD_PROCESS_SHARED) is failing as well.  See the attached 

Shared rwlock vars are currently not supported.  The reason is:
Nobody implemented them so far.  http://cygwin.com/contrib.html

>> cygwin-pthread-bug.c for details.
>> Please help!  Thanks for your time.
>> - Gabriel Landau

> #include <pthread.h>
> #include <errno.h>
> [...]

I have a problem with this testcase.  Cygwin is not working the same
here as Linux, but your testcase doesn't seem to work as expected on
Linux either.  I tested your testcase on three different Linux versions
and the output is always the same:

  $ ./cygwin-pthread-bug 
  Lock attribute property set successfully!
  Unlocking of an unlocked lock succeeded when it should not have.

  Trying 10 recursive RO locks with NULL (default) attributes ...
  Lock recursion iteration 0 failed!
  Lock recursion iteration 1 failed!
  Lock recursion iteration 2 failed!
  Lock recursion iteration 3 failed!
  Lock recursion iteration 4 failed!
  Lock recursion iteration 5 failed!
  Lock recursion iteration 6 failed!
  Lock recursion iteration 7 failed!
  Lock recursion iteration 8 failed!
  Lock recursion iteration 9 failed!
  Unlock recursion iteration 0 succeeded!
  Unlock recursion iteration 1 succeeded!
  Unlock recursion iteration 2 succeeded!
  Unlock recursion iteration 3 succeeded!
  Unlock recursion iteration 4 succeeded!
  Unlock recursion iteration 5 succeeded!
  Unlock recursion iteration 6 succeeded!
  Unlock recursion iteration 7 succeeded!
  Unlock recursion iteration 8 succeeded!
  Unlock recursion iteration 9 succeeded!
  Unlocking of an unlocked lock succeeded when it should not have.
  Unlocking of an unlocked lock succeeded when it should not have.

  Trying 10 recursive RO locks with permissive custom attributes ...
  Lock recursion iteration 0 failed!
  Lock recursion iteration 1 failed!
  Lock recursion iteration 2 failed!
  Lock recursion iteration 3 failed!
  Lock recursion iteration 4 failed!
  Lock recursion iteration 5 failed!
  Lock recursion iteration 6 failed!
  Lock recursion iteration 7 failed!
  Lock recursion iteration 8 failed!
  Lock recursion iteration 9 failed!
  Unlock recursion iteration 0 succeeded!
  Unlock recursion iteration 1 succeeded!
  Unlock recursion iteration 2 succeeded!
  Unlock recursion iteration 3 succeeded!
  Unlock recursion iteration 4 succeeded!
  Unlock recursion iteration 5 succeeded!
  Unlock recursion iteration 6 succeeded!
  Unlock recursion iteration 7 succeeded!
  Unlock recursion iteration 8 succeeded!
  Unlock recursion iteration 9 succeeded!
  Unlocking of an unlocked lock succeeded when it should not have.

This output doesn't look very reliable.  On Cygwin, at least recursion 0
works fine ;}

I'm not overly fluent with pthread usage, but if you can provide a
testcase which actually works OOTB on Linux and only shows a problem
on Cygwin, I'll have another look.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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


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