preshing / junction

Concurrent data structures in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG : Stucked while use mutator.getValue, but no error or exit.

NUAAguo opened this issue · comments

when i use these codes , it stucked at the ninth data, mutator.getValue() returns nothing and no error message.

            junction::ConcurrentMap_Leapfrog<turf::u32 ,turf::u32> HashTable;
            for(int k=0; k<9; ++k)
            {
                turf::u32 model_index = newI[k];
                turf::u32 scene_index = newJ[k];
                junction::ConcurrentMap_Leapfrog<turf::u32, unsigned int>::Mutator mutator = HashTable.insertOrFind(scene_index);
                if (mutator.getValue())
                {
                  //  turf::u32 thash = mutator.getValue();

                  //  if(distances[thash] > distances[model_index])
                    {
                        HashTable.exchange(scene_index,model_index);
                    }
                }
                else
                {
                    HashTable.exchange(scene_index,model_index);
                }
            }

where int newI[9] = {0,1,2,3,4,5,7,8,9};
int newJ[9] = {24814,75961,46974,77578,26819,70099,70420,31706,69132};

By default, you can't use 0 as a key. See "Rules and Behavior" section in the README. If you run in Debug, it should trigger an assert on line 192 of junction::details::LeapFrog<>::insertOrFind().