The semantics of TBB's conaintainers

The semantics of TBB's conaintainers

Portrait de Kubera

Hi!

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

Wlodzimierz O. Kubera
6 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Raf Schietekat

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

Portrait de Kubera

I am using a concurrent_hash_map template.

Wlodzimierz O. Kubera
Portrait de Raf Schietekat

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.".

Portrait de Kubera

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

Wlodzimierz O. Kubera
Portrait de Kubera

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

Wlodzimierz O. Kubera

Connectez-vous pour laisser un commentaire.