8 Mar
2015
8 Mar
'15
3:06 p.m.
Matwey V. Kornilov
Hi,
I have a multi_index container and would like to make concurrent READs. Is it thread-safe? I mean that there could be mutable members inside the object, so calling formally const functions leaded to concurrent writes.
Adding to Ernest's answer: if your formally const function changes the value of some mutable data member, then concurrent access is NOT safe. For instance: struct X { int x; mutable std::size_t count; int get_x()const { ++count; return x; } }; Concurrent execution of X::get_x is not safe. This has nothing to do with Boost.MultiIndex, by the way; if your problem is different please answer back. Joaquín M López Muñoz Telefónica