SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Mutex.cpp
1 #include "Mutex.h"
2 
3 #include <sqlite3.h>
4 
5 namespace sqlite {
6  mutex::mutex(sqlite3_mutex *mutex) :
7  native_handle(mutex)
8  {}
9 
10  void mutex::lock() noexcept {
11  sqlite3_mutex_enter(native_handle);
12  }
13 
14  bool mutex::try_lock() noexcept {
15  return sqlite3_mutex_try(native_handle) == SQLITE_OK;
16  }
17 
18  void mutex::unlock() noexcept {
19  sqlite3_mutex_leave(native_handle);
20  }
21 }