I have a Concurrency::concurrent_vector and want to push_back thread safe a new element only in case it not already exists (that's why I have to perform a search first). How can I accomplish this ? I need a concurrent collection that it's thread safe at iterator access(write,read same element) and also permits what I wrote above.
Question refinement: What would be the best container to use if it's mostly searched concurrently, if element is not found (more rare) an insert/push_back would be needed and in case search element is found (most of the cases) update to an element is needed (concurrent update of the same iterator)
From what is already available in VS2010 I saw concurrent_vector but that it is not safe at updating the same element and also it seems that I need an extra lock in case an element is not found and I need to add an element because of that. What do you think ? Is there something I can use to eliminate external locks (whole container locks)?