31#include <system_error> 
   50  inline constexpr mutex() noexcept : m_mtx{} {}
 
 
  112template <
class Mutex>
 
  141template <
class Mutex>
 
  149  inline unique_lock() noexcept : m_mtx{
nullptr}, m_owns{
false} {}
 
  165      : m_mtx{&mtx}, m_owns{mtx.
try_lock()} {}
 
 
  171      : m_mtx{&mtx}, m_owns{true} {}
 
 
  181                                                    m_owns{
lock.m_owns} {
 
  182    lock.m_mtx = 
nullptr;
 
 
  193    m_owns = 
lock.m_owns;
 
  194    lock.m_mtx = 
nullptr;
 
 
  218    std::swap(m_mtx, 
lock.m_mtx);
 
  219    std::swap(m_owns, 
lock.m_owns);
 
 
  239  inline bool owns_lock() const noexcept { 
return m_owns; }
 
  245  inline explicit operator bool() const noexcept { 
return m_owns; }
 
 
  260template <
class Mutex>
 
  262  if (m_mtx == 
nullptr) {
 
  263    throw std::system_error(
 
  264      std::make_error_code(std::errc::operation_not_permitted),
 
  265      "References null mutex.");
 
  268    throw std::system_error(
 
  269      std::make_error_code(std::errc::resource_deadlock_would_occur),
 
 
  276template <
class Mutex>
 
  278  if (m_mtx == 
nullptr) {
 
  279    throw std::system_error(
 
  280      std::make_error_code(std::errc::operation_not_permitted),
 
  281      "References null mutex.");
 
  284    throw std::system_error(
 
  285      std::make_error_code(std::errc::resource_deadlock_would_occur),
 
  288  m_owns = m_mtx->try_lock();
 
 
  292template <
class Mutex>
 
  295    throw std::system_error(
 
  296      std::make_error_code(std::errc::operation_not_permitted),
 
  297      "Mutex not locked.");
 
 
  308template <
class Mutex>
 
C++11 compliant implementation of unique lock.
 
Mutex mutex_type
The type of Mutex used by the lock_guard.
 
lock_guard(mutex_type &mtx)
Constructs a lock_gurad from a Mutex and locks it.
 
lock_guard(mutex_type &mtx, adopt_lock_t)
Constructs a lock_guard from a Mutex, acquireing ownership without locking it.
 
C++11 compliant implementation of mutex, uses the time point implemented in our chrono replacement in...
 
void lock()
Lock the mutex.
 
bool try_lock() noexcept
Try to lock the mutex.
 
mutex_t * native_handle_type
The native handle type used by the mutex.
 
void unlock() noexcept
Unlock the mutex.
 
native_handle_type native_handle()
Provides access to the native handle.
 
C++11 compliant implementation of unique lock.
 
unique_lock(unique_lock &&lock) noexcept
Move constructor.
 
Mutex mutex_type
The type of Mutex used by the lock.
 
unique_lock & operator=(unique_lock &&lock) noexcept
Move assignment operator.
 
bool try_lock()
Tries to lock the associated mutex.
 
void swap(unique_lock &lock) noexcept
Swap this unique_lock with another unique_lock.
 
bool owns_lock() const noexcept
Query ownership of the associate mutex.
 
void lock()
Locks the associated mutex.
 
unique_lock(mutex_type &mtx, try_to_lock_t)
Constructs a unique_lock from a Mutex and tries to lock it.
 
mutex_type * mutex() const noexcept
Provides access to the associated mutex.
 
void unlock()
Unlocks the associated mutex.
 
unique_lock(mutex_type &mtx, adopt_lock_t)
Constructs a unique_lock from a Mutex that is already owned by the thread.
 
unique_lock(mutex_type &mtx, defer_lock_t) noexcept
Constructs a unique_lock from a Mutex but does not lock it.
 
unique_lock(mutex_type &mtx)
Constructs a unique_lock from a Mutex and locks it.
 
mutex_type * release() noexcept
Disassociate this lock from its mutex.
 
Mutex for thread synchronization.
 
constexpr defer_lock_t defer_lock
Tag constant for defer lock strategy.
 
constexpr try_to_lock_t try_to_lock
Tag constant for try lock strategy.
 
constexpr adopt_lock_t adopt_lock
Tag constant for adopt lock strategy.
 
void swap(unique_lock< Mutex > &lhs, unique_lock< Mutex > &rhs) noexcept
Swaps two mutexes.
 
Mutex struct within mqtt paho.
 
mutex_t lock
MQTT thread mutex.
 
Tag type for adopt lock strategy.
 
Tag type for defer lock strategy.
 
Tag type for try lock strategy.