SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Mutex.h
Go to the documentation of this file.
1 
3 #ifndef __SQLITEXX_SQLITE_MUTEX_H__
4 #define __SQLITEXX_SQLITE_MUTEX_H__
5 
6 #include <sqlite3.h>
7 
8 namespace sqlite {
9 
19  class mutex {
20  public:
21  explicit mutex(sqlite3_mutex *mutex);
22  mutex(const mutex &other) = default;
23 
26  void lock() noexcept;
27 
31  bool try_lock() noexcept;
32 
35  void unlock() noexcept;
36 
37  private:
38  sqlite3_mutex *native_handle;
39  };
40 }
41 
42 #endif
bool try_lock() noexcept
Tries to lock the mutex, returns if the mutex is not available.
Definition: Mutex.cpp:14
Helps with serializing access to a database connection.
Definition: Mutex.h:19
void unlock() noexcept
Unlocks the mutex.
Definition: Mutex.cpp:18
void lock() noexcept
Locks the mutex and blocks if the mutex is not available.
Definition: Mutex.cpp:10