51 #if PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY
59 #if !PICO_MUTEX_ENABLE_SDK120_COMPATIBILITY
249 return mtx->core.spin_lock != 0;
259 return mtx->core.spin_lock != 0;
283 #define auto_init_mutex(name) static __attribute__((section(".mutex_array"))) mutex_t name
306 #define auto_init_recursive_mutex(name) static __attribute__((section(".mutex_array"))) recursive_mutex_t name = { .core = { .spin_lock = (spin_lock_t *)1
}, .owner = 0, .enter_count = 0 }
#define lock_owner_id_t
type to use to store the 'owner' of a lock.By default this is int8_t as it only needs to store the co...
Definition: lock_core.h:80
void recursive_mutex_exit(recursive_mutex_t *mtx)
Release ownership of a recursive mutex.
Definition: mutex.c:185
void recursive_mutex_init(recursive_mutex_t *mtx)
Initialise a recursive mutex structure.
Definition: mutex.c:19
bool mutex_enter_timeout_ms(mutex_t *mtx, uint32_t timeout_ms)
Wait for mutex with timeout.
Definition: mutex.c:111
bool mutex_enter_timeout_us(mutex_t *mtx, uint32_t timeout_us)
Wait for mutex with timeout.
Definition: mutex.c:119
void mutex_enter_blocking(mutex_t *mtx)
Take ownership of a mutex.
Definition: mutex.c:29
bool mutex_enter_block_until(mutex_t *mtx, absolute_time_t until)
Wait for mutex until a specific time.
Definition: mutex.c:127
bool recursive_mutex_enter_block_until(recursive_mutex_t *mtx, absolute_time_t until)
Wait for mutex until a specific time.
Definition: mutex.c:151
bool mutex_try_enter_block_until(mutex_t *mtx, absolute_time_t until)
Attempt to take ownership of a mutex until the specified time.
Definition: mutex.c:83
static bool recursive_mutex_is_initialized(recursive_mutex_t *mtx)
Test for recursive mutex initialized state.
Definition: mutex.h:258
struct __packed_aligned mutex mutex_t
regular (non recursive) mutex instance
bool mutex_try_enter(mutex_t *mtx, uint32_t *owner_out)
Attempt to take ownership of a mutex.
Definition: mutex.c:64
struct __packed_aligned recursive_mutex_t
recursive mutex instance
void mutex_init(mutex_t *mtx)
Initialise a mutex structure.
Definition: mutex.c:10
void recursive_mutex_enter_blocking(recursive_mutex_t *mtx)
Take ownership of a recursive mutex.
Definition: mutex.c:48
bool recursive_mutex_enter_timeout_ms(recursive_mutex_t *mtx, uint32_t timeout_ms)
Wait for recursive mutex with timeout.
Definition: mutex.c:115
bool recursive_mutex_try_enter(recursive_mutex_t *mtx, uint32_t *owner_out)
Attempt to take ownership of a recursive mutex.
Definition: mutex.c:94
static bool mutex_is_initialized(mutex_t *mtx)
Test for mutex initialized state.
Definition: mutex.h:248
bool recursive_mutex_enter_timeout_us(recursive_mutex_t *mtx, uint32_t timeout_us)
Wait for recursive mutex with timeout.
Definition: mutex.c:123
void mutex_exit(mutex_t *mtx)
Release ownership of a mutex.
Definition: mutex.c:172
recursive mutex instance
Definition: mutex.h:47
uint8_t enter_count
owner id LOCK_INVALID_OWNER_ID for unowned
Definition: mutex.h:50
Definition: lock_core.h:53
regular (non recursive) mutex instance
Definition: mutex.h:60