Boost logo

Boost Users :

Subject: [Boost-users] Boost Threading Multiple Reader / Single Writer Usage Questions
From: Brian Nantz (brian_at_[hidden])
Date: 2010-02-17 08:14:59


 I am working in legacy code and I have a list collection of pointers that
is accessed by multiple threads. I am having some thread locking issues
with it. Mostly the list is read and very few changes (adds or deletes) are
made to the list. I thought this would be a great opportunity to use a
Reader Writer Lock (RWL).

It seems that the shared_mutex is the Boost RWL. There are a few
requirements that I am not sure shared_mutex will do for me:

1. There could be nested locks and the RWL should handle unwinding
them correctly. I see that recursive_mutex seems to handle that. Does
shared_mutex handle that as well?

2. Is there a way to give a higher priority to writes? I am worried
about the readers starving the writers, so I would like any pending writers
to be given preference over pending readers.

How can I get this functionality from the Boost thread library? If I need
to build my own, what class do you recommend using as a base to build from?



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net