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

Gauthier, Simon Simon.Gauthier at verint.com
Wed Feb 10 13:04:38 UTC 2010


Hi,

Here is the thread setting in my .config.

# HAS_NO_THREADS is not set
UCLIBC_HAS_THREADS=y
# PTHREADS_DEBUG_SUPPORT is not set
LINUXTHREADS_OLD=y

Removing the sleep in the timer thread gives me a similar results.

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].
The list is locked by the timer thread [1].
The list is locked by the timer thread [2].
The list is unlocked by the timer thread [2].
The list is locked by the timer thread [2].
The list is unlocked by the timer thread [2].

What happen now is that the thread 1 takes the lock, then the thread 2, then the thread 2 unlock and the thread 1 is block forever?

Thanks

Simon Gauthier

-----Original Message-----
From: Khem Raj [mailto:raj.khem at gmail.com] 
Sent: Tuesday, February 09, 2010 9:32 PM
To: Gauthier, Simon
Cc: uclibc at uclibc.org
Subject: Re: Pthread Read/Write Lock Freeze one of the calling thread.

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
This electronic message may contain proprietary and confidential information of Verint Systems Inc., its affiliates and/or subsidiaries.
The information is intended to be for the use of the individual(s) or
entity(ies) named above.  If you are not the intended recipient (or authorized to receive this e-mail for the intended recipient), you may not use, copy, disclose or distribute to anyone this message or any information contained in this message.  If you have received this electronic message in error, please notify us by replying to this e-mail.



More information about the uClibc mailing list