The semantics of TBB's conaintainers

The semantics of TBB's conaintainers


Could Someone answer my question, please?

I have added a concurrent map to my project. The question is, how many instances of one single value would be temporarilly existing while modifing the data of container (for example, insert() method)? The qestion is not about copy/move semtantics. I have read, that movable semantics is not impleneted int the TBB yet. Is there a reference counting important for the values? Would it be possible to create the movable constructor and the operator and disable the copy ctor and operator?

Maybe someone would answer my qestion and consider writting a few words about the architecture of TBB.

Thank you very much and Happy Christmass

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You have to be specific about the kind of map: concurrent_hash_map or concurrent_unordered_map?

I am using a concurrent_hash_map template.

For concurrent_hash_map it is possible for several threads to have accessors to elements with the same key that are not part of the map anymore because other threads erase()'d them. This is mentioned in the Reference Manual: in the version I downloaded a while ago there is a CAUTION that: "Though there can be at most one occurrence of a given key in the map, there may be other key-value pairs in flight with the same key. These arise from the semantics of the insert and erase methods. The insert methods can create and destroy a temporary key-value pair that is not inserted into a map. The erase methods remove a key-value pair from the map before destroying it, thus permitting another thread to construct a similar key before the old one is destroyed.".

I highly appreciate the answer.
It would be enough for me.

This thread would be closed.
How it would be done?

Leave a Comment

Please sign in to add a comment. Not a member? Join today