Semantics of STL containers (std::map) in a multithreaded scenario

P

Pete Becker

Joe said:
That's a known issue. The usual solution is to use atomic types
with the right guarantees, i.e. atomicity and acquire or release
semantics if needed. STL don't use atomic types so you don't know
if they can be used in this way since it's compiler and platform
dependent.

Yes, that is the point of the example.
The more insideous problem is you can't just arbitrarily move things
around and expect that the proper semantics will hold.

It's essentially the same issue: if you don't have a guarantee of
atomicity, all bets are off. (Unless you have some other eplicit guarantee)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top