Possible Duplicate:
Thread safety of std::map for read-only operations
Having std::map a
can we do a.find(...)->second
in multiple threads at the same time on it?
Possible Duplicate:
Thread safety of std::map for read-only operations
Having std::map a
can we do a.find(...)->second
in multiple threads at the same time on it?
Yes. As long as none of your threads do a write
i.e. Construct the data structure in memory
Use as many threads to find/read as you require.
If the leaf needs altering put a mutex there.