18#include "pw_preprocessor/util.h"
19#include "pw_sync/lock_annotations.h"
23#include "pw_sync/virtual_basic_lockable.h"
24#include "pw_sync_backend/mutex_native.h"
42class PW_LOCKABLE(
"pw::sync::Mutex")
Mutex {
44 using native_handle_type = backend::NativeMutexHandle;
58 void lock() PW_EXCLUSIVE_LOCK_FUNCTION();
66 [[nodiscard]]
bool try_lock() PW_EXCLUSIVE_TRYLOCK_FUNCTION(true);
72 void unlock() PW_UNLOCK_FUNCTION();
74 [[nodiscard]] native_handle_type native_handle();
80 backend::NativeMutex& native_type() {
return native_type_; }
81 const backend::NativeMutex& native_type()
const {
return native_type_; }
85 backend::NativeMutex native_type_;
91 Mutex& mutex() {
return impl(); }
96#include "pw_sync_backend/mutex_inline.h"
109void pw_sync_Mutex_Lock(
pw_sync_Mutex* mutex) PW_NO_LOCK_SAFETY_ANALYSIS;
112bool pw_sync_Mutex_TryLock(
pw_sync_Mutex* mutex) PW_NO_LOCK_SAFETY_ANALYSIS;
115void pw_sync_Mutex_Unlock(
pw_sync_Mutex* mutex) PW_NO_LOCK_SAFETY_ANALYSIS;
Definition: virtual_basic_lockable.h:108