In the below code, if I do not release a1
the code seems to be stuck in an infinite loop inside the map.find
function.
What if I need to search for an element in two different parts of the application?
#include <iostream>
#include "tbb/concurrent_hash_map.h"
using namespace std;
using namespace tbb;
void main()
{
concurrent_hash_map<int, int> map;
concurrent_hash_map<int, int>::accessor a1, a2;
map.insert(make_pair(1, 111));
cout << "a1 - " << map.find(a1, 1) << endl;
//a1.release();
cout << "a2 - " << map.find(a2, 1) << endl;
}