Hi!
I develop a module with multiple threads and one Cache in std::map. Some times I need to update cache. In that time all readers must wait, while I do update map.
How can I do this synchronization with boost library?
P.S.: some time ago in Boost was read_write_mutex. But in current releases of Boost it missed.
views:
224answers:
1
+3
A:
will
shared_mutex
replaceread_write_mutex
?Yes.
...
Basically
unique_lock<shared_mutex>
will give you a write lock,shared_lock<shared_mutex>
will give you a read lock, andupgrade_mutex<shared_mutex>
will give you a read lock than you can upgrade by transferring ownership (with move) to aunique_lock<shared_mutex>
.
Tim Sylvester
2009-08-28 20:07:45
Thanks Tim!Don't knew this.
Vitaly Dyatlov
2009-08-28 20:21:18