From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: "Steve Simon" Date: Thu, 22 Sep 2011 12:22:21 +0100 To: 9fans@9fans.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] rwlocks on plan9 Topicbox-Message-UUID: 2b97036e-ead7-11e9-9d60-3106f5b1d025 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