Skip to content

Commit

Permalink
[Refactoring] Make CEvoDB mutex public
Browse files Browse the repository at this point in the history
it will be locked from outside when iterating mined commitments (ref.
dash@c68b5f68aa41881c3bf36d8881b60b6855868605)
  • Loading branch information
random-zebra committed Apr 11, 2021
1 parent 304fc46 commit 8850b3e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/evo/evodb.h
Expand Up @@ -30,8 +30,10 @@ class CEvoDBScopedCommitter

class CEvoDB
{
private:
public:
RecursiveMutex cs;

private:
CDBWrapper db;

typedef CDBTransaction<CDBWrapper, CDBBatch> RootTransaction;
Expand All @@ -50,6 +52,12 @@ class CEvoDB
return std::make_unique<CEvoDBScopedCommitter>(*this);
}

CurTransaction& GetCurTransaction()
{
AssertLockHeld(cs); // lock must be held from outside as long as the DB transaction is used
return curDBTransaction;
}

template<typename K, typename V>
bool Read(const K& key, V& value)
{
Expand Down

0 comments on commit 8850b3e

Please sign in to comment.