148 #define MUTEX_INIT { { NULL } }
153 #define MUTEX_INIT_LOCKED { { MUTEX_LOCKED } }
160 #define MUTEX_LOCKED ((list_node_t *)-1)
252 #if (MAXTHREADS > 1) || DOXYGEN
261 volatile uintptr_t *lock = (
void *)&mutex->
queue.
next;
311 #if (MAXTHREADS > 1) || DOXYGEN
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
void mutex_lock(mutex_t *mutex)
Locks a mutex, blocking.
void mutex_unlock(mutex_t *mutex)
Unlocks the mutex.
void mutex_cancel(mutex_cancel_t *mc)
Cancels a call to mutex_lock_cancelable.
static mutex_cancel_t mutex_cancel_init(mutex_t *mutex)
Initialize a mutex cancellation structure.
int mutex_lock_cancelable(mutex_cancel_t *mc)
Locks a mutex, blocking.
int mutex_trylock_ffi(mutex_t *mutex)
Tries to get a mutex, non-blocking.
static void mutex_init(mutex_t *mutex)
Initializes a mutex object.
void mutex_unlock_and_sleep(mutex_t *mutex)
Unlocks the mutex and sends the current thread to sleep.
static int mutex_trylock(mutex_t *mutex)
Tries to get a mutex, non-blocking.
static thread_t * thread_get_active(void)
Returns a pointer to the Thread Control Block of the currently running thread.
Common macros and compiler attributes/pragmas configuration.
thread_t holds thread's context data.
struct list_node * next
pointer to next list entry
A cancellation structure for use with mutex_lock_cancelable and mutex_cancel.
thread_t * thread
The thread trying to lock the mutex.
uint8_t cancelled
Flag whether the mutex has been cancelled.
mutex_t * mutex
The mutex to lock.
list_node_t queue
The process waiting queue of the mutex.
Provides utility functions for event handler threads.