Skip to content

Commit

Permalink
Added recursive_mutex in associative cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rickb80 committed Aug 20, 2023
1 parent cff8844 commit d9b74f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hashdb/database_associative_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ DatabaseMTAssociativeCache::~DatabaseMTAssociativeCache()

void DatabaseMTAssociativeCache::postConstruct(int nKeyBits_, int log2CacheSize_, string name_)
{
lock_guard<recursive_mutex> guard(mlock);
nKeyBits = nKeyBits_;
if (nKeyBits_ > 32)
{
Expand Down Expand Up @@ -102,7 +103,7 @@ void DatabaseMTAssociativeCache::postConstruct(int nKeyBits_, int log2CacheSize_

void DatabaseMTAssociativeCache::addKeyValue(Goldilocks::Element (&key)[4], const vector<Goldilocks::Element> &value, bool update)
{

lock_guard<recursive_mutex> guard(mlock);
//
// Statistics
//
Expand Down Expand Up @@ -280,6 +281,7 @@ void DatabaseMTAssociativeCache::forcedInsertion(uint32_t (&rawCacheIndexes)[10]

bool DatabaseMTAssociativeCache::findKey(Goldilocks::Element (&key)[4], vector<Goldilocks::Element> &value)
{
lock_guard<recursive_mutex> guard(mlock);
attempts++;
for (int i = 0; i < 4; i++)
{
Expand Down

0 comments on commit d9b74f7

Please sign in to comment.