PatchworkOS  2ca1c69
A non-POSIX operating system.
Loading...
Searching...
No Matches
Mutex

Mutex. More...

Collaboration diagram for Mutex:

Detailed Description

Mutex.

This module provides functionality for acquiring and releasing AML mutexes.

Note that mutexes currently do... nothing. Instead we just use one big mutex for the entire parser, but we still implement their behaviour to check for invalid code or errors. This really shouldent matter as AML should only be getting executed by one thread at a time anyway.

See also
Section 19.6.89 of the ACPI specification for more details.

Typedefs

typedef uint64_t aml_mutex_id_t
 Mutex id.
 

Functions

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.
 

Typedef Documentation

◆ aml_mutex_id_t

Mutex id.

Definition at line 28 of file mutex.h.

Function Documentation

◆ aml_mutex_id_init()

void aml_mutex_id_init ( aml_mutex_id_t mutex)

Create a new mutex and return its id.

Parameters
mutexThe mutex id to initialize.

Definition at line 84 of file mutex.c.

Here is the caller graph for this function:

◆ aml_mutex_id_deinit()

void aml_mutex_id_deinit ( aml_mutex_id_t mutex)

Destroy the mutex with the given id.

Parameters
mutexThe mutex id to destroy.

Definition at line 89 of file mutex.c.

Here is the caller graph for this function:

◆ aml_mutex_acquire()

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.

If the mutex is already owned by the current thread, this function will return immediately. If the mutex has a lower SyncLevel than the current SyncLevel, this function will fail.

Parameters
mutexThe mutex to acquire.
syncLevelThe SyncLevel at which to acquire the mutex.
timeoutThe timeout in clock ticks to wait for the mutex, or CLOCKS_NEVER to wait indefinitely.
Returns
On success, 0. If timed out, 1. On failure, ERR and errno is set.

Definition at line 94 of file mutex.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ aml_mutex_release()

uint64_t aml_mutex_release ( aml_mutex_id_t mutex)

Release a mutex.

The mutex must have a SyncLevel equal to the current SyncLevel and must be owned by the current thread.

Parameters
mutexThe mutex to release.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 114 of file mutex.c.

Here is the call graph for this function:
Here is the caller graph for this function: