Its quite possible that I'am doing somthing foolish,
but just in case its in the design...
It appears to me that when using rwlocks on plan9
I have to release the read lock before I can take the write lock
in a process - i.e. a single process cannot hold both.
This means that when updating a data structure I do this:
rlock()
search_structure()
if(found){
runlock()
return
}
runlock()
wlock()
search_structure() # search a seccond time
if(found){ # lost the race
wunlock()
return
}
add_entry() # won the race
wlock()
return
If I could hold both locks I wouldn't need to do the seccond
search.
is this how its susposed to work?
-Steve