
Bill, You can build a r/w lock that preferrs writers on top of boost::condition_variable. See the "Write-Priority Read/Write Locks" section of the page: http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.genpr ogc/doc/genprogc/complex_synchronization_objects.htm for an example on top of pthread_cond_t. Converting to boost:condition_variable should be mostly an exercise in search/replace. The site is very slow today, you might want to see the Google cache version: http://72.14.205.104/search?q=cache:TzrAWFUhsc8J:publib.boulder.ibm.com/ infocenter/systems/topic/com.ibm.aix.genprogc/doc/genprogc/complex_synch ronization_objects.htm+pthread_cond_t+reader+writer+lock&hl=en&ct=clnk&c d=4&gl=us Essentially you keep a pair of condition variables that share a single mutex. State is held by two integers. A lock count integer is -1 when held by writer, 0 for free and >0 when held by readers. A waiting_writers integer counts the number of waiting writers. New readers can only acquire the lock when lock_count is >= 0 waiting_writers == zero. Sincerely, Paul Rose
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Bill David Sent: Wednesday, September 17, 2008 10:12 AM To: boost@lists.boost.org Subject: [boost] How to implement a reader-writer lock with quick responseto writer?
Question: How to implement a reader-writer lock with quick response to writer?