Skip to content

Commit

Permalink
Protect threaded access to record map
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgr committed Jul 30, 2020
1 parent 9b4ab88 commit 8b02488
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/RecordTable.h
Expand Up @@ -117,8 +117,13 @@ class RecordTable {
}
/** @brief convert record reference to a record */
const RamDomain* unpack(RamDomain ref, size_t arity) const {
auto iter = maps.find(arity);
assert(iter != maps.end() && "Attempting to unpack non-existing record");
std::unordered_map<size_t, RecordMap>::const_iterator iter;
#pragma omp critical(RecordTableGetForArity)
{
// Find a previously emplaced map
iter = maps.find(arity);
}
assert(iter != maps.end() && "Attempting to unpack record for non-existing arity");
return (iter->second).unpack(ref);
}

Expand Down

0 comments on commit 8b02488

Please sign in to comment.