22 return sqlite3_mutex_try(impl_.get()) == SQLITE_OK;
24 void lock() { sqlite3_mutex_enter(impl_.get()); }
25 void unlock() { sqlite3_mutex_leave(impl_.get()); }
27 mutex() : impl_(sqlite3_mutex_alloc(SQLITE_MUTEX_FAST)) {}
30 struct deleter_ {
void operator()(sqlite3_mutex *mtx) {sqlite3_mutex_free(mtx);}};
31 std::unique_ptr<sqlite3_mutex, deleter_> impl_;
41 return sqlite3_mutex_try(impl_.get()) == SQLITE_OK;
43 void lock() { sqlite3_mutex_enter(impl_.get()); }
44 void unlock() { sqlite3_mutex_leave(impl_.get()); }
46 recursive_mutex() : impl_(sqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE)) {}
49 struct deleter_ {
void operator()(sqlite3_mutex *mtx) {sqlite3_mutex_free(mtx);}};
50 std::unique_ptr<sqlite3_mutex, deleter_> impl_;