PatchworkOS
Loading...
Searching...
No Matches
mutex.c File Reference
#include <kernel/acpi/aml/runtime/mutex.h>
#include <kernel/log/log.h>
#include <kernel/sched/sched.h>
#include <kernel/sched/thread.h>
#include <errno.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  aml_mutex_entry_t
 

Functions

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)
 
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.
 
uint64_t aml_mutex_release (aml_mutex_id_t *mutex)
 Release a mutex.
 

Variables

static bool initialized = false
 
static aml_sync_level_t currentSyncLevel = 0
 
static list_t mutexStack
 
static atomic_int32_t newMutexId = ATOMIC_VAR_INIT(1)
 

Function Documentation

◆ aml_mutex_stack_pop()

◆ aml_mutex_stack_push()

Variable Documentation

◆ currentSyncLevel

aml_sync_level_t currentSyncLevel = 0
static

Definition at line 18 of file mutex.c.

Referenced by aml_mutex_stack_pop(), and aml_mutex_stack_push().

◆ initialized

bool initialized = false
static

Definition at line 17 of file mutex.c.

Referenced by aml_mutex_stack_push().

◆ mutexStack

list_t mutexStack
static

Definition at line 19 of file mutex.c.

Referenced by aml_mutex_stack_pop(), and aml_mutex_stack_push().

◆ newMutexId

atomic_int32_t newMutexId = ATOMIC_VAR_INIT(1)
static

Definition at line 21 of file mutex.c.

Referenced by aml_mutex_id_init().