Skip to content

Commit

Permalink
removed database locking macros and used actual functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri authored and pstorz committed May 30, 2023
1 parent 622b5a3 commit 65117cc
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/cats/cats.h
Expand Up @@ -460,9 +460,6 @@ typedef enum
typedef void(DB_LIST_HANDLER)(void*, const char*);
typedef int(DB_RESULT_HANDLER)(void*, int, char**);

#define DbLock(mdb) mdb->LockDb(__FILE__, __LINE__)
#define DbUnlock(mdb) mdb->UnlockDb(__FILE__, __LINE__)

class pathid_cache;

// Initial size of query hash table and hint for number of pages.
Expand Down Expand Up @@ -1027,8 +1024,15 @@ class DbLocker {
BareosDb* db_handle_;

public:
DbLocker(BareosDb* db_handle) : db_handle_(db_handle) { DbLock(db_handle_); }
~DbLocker() { DbUnlock(db_handle_); }
DbLocker(BareosDb* db_handle) : db_handle_(db_handle)
{
db_handle_->LockDb(__FILE__, __LINE__);
}
~DbLocker() { db_handle_->UnlockDb(__FILE__, __LINE__); }

DbLocker(const DbLocker& other) = delete;
DbLocker& operator=(const DbLocker&) = delete;
DbLocker(DbLocker&& other) = delete;
};

// Pooled backend connection.
Expand Down

0 comments on commit 65117cc

Please sign in to comment.