Pthread Read/Write Lock Freeze one of the calling thread.

Khem Raj raj.khem at gmail.com
Wed Feb 10 02:32:24 UTC 2010


On Tue, Feb 9, 2010 at 1:04 PM, Gauthier, Simon
<Simon.Gauthier at verint.com> wrote:
> Hi,
>
> I have two threads locking the same rwlock. When the second takes the lock while the first has it, the second thread deadlock forever on the lock. But the first one unlock and can still lock and unlock the rwlock. This behavior is not seen on a i386 with glibc.
>
> I am using uclibc 0.9.29 with cross compile toolchain for ARM926EJ-S rev 5 (v5l).
>
> Here is the ouput of the test app:
>
> root at test:/mnt/nfs/lock# ./locktestarm
> ucLibc rwlock test.
> Entering worker thread [1].
> The list is locked by the timer thread [1].
> Entering worker thread [2].
> The list is locked by the timer thread [2].
> Entering main thread.
> The list is unlocked by the timer thread [1].
> The list is locked by the timer thread [1].
> The list is unlocked by the timer thread [1].
> The list is locked by the timer thread [1].
> The list is unlocked by the timer thread [1].
>
> We see both worker thread takes the lock, the second thread will then be locked forever on it.

which threading library are you using LT, LT.old or nptl ?
secondly can you try to remove sleep(1) from timer_thread ()
and run the program for a bit longer (say 2 mins ) and check
if it still it hung

Thanks
-Khem


More information about the uClibc mailing list