33 LOG_ERR(
"Attempted to acquire a mutex with a lower SyncLevel than the current SyncLevel\n");
56 LOG_ERR(
"Attempted to release a mutex when none are held\n");
62 if (topEntry->
id !=
id)
64 LOG_ERR(
"Mutex release not in LIFO order\n");
static aml_sync_level_t currentSyncLevel
static uint64_t aml_mutex_stack_push(aml_mutex_id_t id, aml_sync_level_t syncLevel)
static uint64_t aml_mutex_stack_pop(aml_mutex_id_t id)
static atomic_int32_t newMutexId
uint64_t aml_mutex_id_t
Mutex id.
uint64_t aml_mutex_release(aml_mutex_id_t *mutex)
Release a mutex.
void aml_mutex_id_init(aml_mutex_id_t *mutex)
Create a new mutex and return its id.
void aml_mutex_id_deinit(aml_mutex_id_t *mutex)
Destroy the mutex with the given id.
uint64_t aml_mutex_acquire(aml_mutex_id_t *mutex, aml_sync_level_t syncLevel, clock_t timeout)
Acquire a mutex, blocking until it is available or the timeout is reached.
#define LOG_ERR(format,...)
#define EINVAL
Invalid argument.
#define EDEADLK
Resource deadlock would occur.
#define errno
Error number variable.
static uint64_t list_length(list_t *list)
Gets the length of the list.
static list_entry_t * list_last(list_t *list)
Gets the last entry in the list without removing it.
static void list_remove(list_t *list, list_entry_t *entry)
Removes a list entry from its current list.
static void list_push(list_t *list, list_entry_t *entry)
Pushes an entry to the end of the list.
static void list_entry_init(list_entry_t *entry)
Initializes a list entry.
static void list_init(list_t *list)
Initializes a list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
#define CONTAINER_OF(ptr, type, member)
Container of macro.
__UINT64_TYPE__ clock_t
A nanosecond time.
#define ATOMIC_VAR_INIT(value)
#define atomic_fetch_add(object, operand)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
aml_sync_level_t syncLevel
A entry in a doubly linked list.