Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

tbb concurrent_hash_map implementation


I am trying to use tbb’s concurrent_hash_map to increase my application’s concurrent performance. Read up about it and implemented it

according to my application but I am seeing crashes..

So, my application is a multi threaded application where I am storing pairs, key is char* and the value is integer. Pseudo code looks like this:

    void  storeName(const char * name)   {

              int id=0;

              // This creates an pair object of name and index

              pair object(name);

              // concurrent_hash_table is an object of tbb::concurrent_hash_map and is declared in .h file

              // read_lock is a const accessor for reading. This find function searches for char* in the table

             // and if not found, create a write_lock.

              bool found = concurrent_hash_table.find(read_lock, name);  

           if (found == FALSE) {

                        concurrent_hash_table.insert(write_lock, name);

// Get integer id somehow.

write_lock->second = id; 


             } else {

// if the name is found in the table then get the value and release it later

id = read_lock->second;




As per my understanding, I am good with the implementation but as I said, there are multiple crashes coming when find returns me FALSE.

Crash have traces of mutexs as well.


Please suggest. Eagerly waiting. 

0 Kudos
0 Replies