I do not know about Microsoft PPL. I just looked at the Intel Thread Building Blocks header files for Intel concurrent_unordered_map, and the insert function returns false as the second part of the returned pair when the key is already on the map.
This is similar to what you need. Make an insert, and if it returns true , then it will be a new insert. If it returns false , then it was already on the map.
Edit: There seems to be some kind of confusion. I did not mean that you should always run insert. I meant that you should look for the value, and if it is missing, try pasting. Two or more threads can sometimes race in insertion, so the work will be duplicated, but this should be a rare event.
source share