Re: Why isn't pthread_rwlock_rdlock() deadlocking???
Re: Why isn't pthread_rwlock_rdlock() deadlocking???
- Subject: Re: Why isn't pthread_rwlock_rdlock() deadlocking???
- From: Jason Coco <email@hidden>
- Date: Thu, 28 May 2009 11:59:57 -0700
On May 28, 2009, at 04:08 , Karan, Cem (Civ, ARL/CISD) wrote:
First off, I apologize for messing up the subject line in my last
post;
I hit the send button a little too quickly.
Greg Parker wrote on Wednesday, May 27, 2009 4:40 PM
"For each lock obtained" is supposed to mean "for each
successful rdlock call". The POSIX description is more explicit:
"A thread may hold multiple concurrent read locks on rwlock
(that is, successfully call the pthread_rwlock_rdlock()
function n times). If so, the thread must perform matching
unlocks (that is, it must call the pthread_rwlock_unlock()
function n times)."
http://www.opengroup.org/onlinepubs/009695399/functions/pthrea
d_rwlock_rdlock.html
That is MUCH clearer! Unless someone has already modified the man
pages, I'll file a bug report requesting that they change the page to
match the above.
That's definitely clearer, but the man page does say that the results
of obtaining a
read or write lock when the current thread already holds the opposite
type of lock
are undefined. Since returning EDEADLOCK is optional, Apple probably
wants to
choose what to do in the future, so the best choice is to ensure that
your code never
does this through review or some other mechanism (as annoying as that
is).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden