Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10704 > unrolled thread
| Started by | Jaydeep Chovatia <chovatia.jaydeep@gmail.com> |
|---|---|
| First post | 2011-10-06 12:32 -0700 |
| Last post | 2011-10-06 15:58 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.c++
pthread_rwlock_rdlock hangs Jaydeep Chovatia <chovatia.jaydeep@gmail.com> - 2011-10-06 12:32 -0700
Re: pthread_rwlock_rdlock hangs Ian Collins <ian-news@hotmail.com> - 2011-10-07 09:20 +1300
Re: pthread_rwlock_rdlock hangs Adam Skutt <askutt@gmail.com> - 2011-10-06 15:58 -0700
| From | Jaydeep Chovatia <chovatia.jaydeep@gmail.com> |
|---|---|
| Date | 2011-10-06 12:32 -0700 |
| Subject | pthread_rwlock_rdlock hangs |
| Message-ID | <fb97ce76-2995-4772-bbfd-756bd6d7e40f@fx14g2000vbb.googlegroups.com> |
Hi,
In my multi-threaded program I am using "pthread_rwlock_rdlock" to
lock read/write mutex which is initialized with
"PTHREAD_MUTEX_ERRORCHECK"
Under load, call to "pthread_rwlock_rdlock" hangs indefinitely even
though there are no writers holding the lock. Even after i stop load
on my program, call is still hung. I tried to take the mutex condition
when it was locked, please find here:
(gdb) p m_lock
$2 = {__data = {__lock = 0, __nr_readers = 1, __readers_wakeup = 60,
__writer_wakeup = 1230, __nr_readers_queued = 2, __nr_writers_queued =
48,
__writer = 0, __pad1 = 0, __pad2 = 0, __pad3 = 0, __flags = 0},
__size = "\000\000\000\000\001\000\000\000<
\000\000\000\316\004\000\000\002\000\000\000\060", '\000' <repeats 34
times>, __align = 4294967296}
After that I changed my lock from "pthread_rwlock_rdlock" to
"pthread_rwlock_tryrdlock" and under load this new lock used to return
EAGAIN sometimes.
My question is why "pthread_rwlock_rdlock" hangs indefinitely. If
there are more readers then it should return EAGAIN.
Any help on this would be appreciated.
OS Details: Red Hat Enterprise Linux Server release 6.0 (Santiago)
Linux rwcdtgxb0406 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT
2010 x86_64 x86_64 x86_64 GNU/Linux
Thank you,
Jaydeep
[toc] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2011-10-07 09:20 +1300 |
| Message-ID | <9f6gsdFtu8U4@mid.individual.net> |
| In reply to | #10704 |
On 10/ 7/11 08:32 AM, Jaydeep Chovatia wrote: > > My question is why "pthread_rwlock_rdlock" hangs indefinitely. If > there are more readers then it should return EAGAIN. > > Any help on this would be appreciated. > > OS Details: Red Hat Enterprise Linux Server release 6.0 (Santiago) > Linux rwcdtgxb0406 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT > 2010 x86_64 x86_64 x86_64 GNU/Linux This isn't a C++ issue, try a Linux group or comp.programming.threads. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | Adam Skutt <askutt@gmail.com> |
|---|---|
| Date | 2011-10-06 15:58 -0700 |
| Message-ID | <b133abc2-a1e8-4e85-a0fc-0b7023dfadb5@d26g2000vby.googlegroups.com> |
| In reply to | #10704 |
On Oct 6, 3:32 pm, Jaydeep Chovatia <chovatia.jayd...@gmail.com> wrote: > Hi, > > In my multi-threaded program I am using "pthread_rwlock_rdlock" to > lock read/write mutex which is initialized with > "PTHREAD_MUTEX_ERRORCHECK" > Under load, call to "pthread_rwlock_rdlock" hangs indefinitely even > though there are no writers holding the lock. Even after i stop load > on my program, call is still hung. I tried to take the mutex condition > when it was locked, please find here: I'm not quite confident about what's going on, since you seem to be confusing two separate concurrency structures. But only recursive mutexes can be locked more than once by the same thread, so I'm pretty confident you're attempting to do something you should not. Error- checking mutexes return an error when they are locked twice, you're probably not checking for the error correctly. A more detailed response is going to require actual code and should probably be addressed to a different newsgroup. Adam
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web