|
PatchworkOS
|
Mutex. More...
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. | |
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.
| 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.
| mutex | The mutex to acquire. |
| syncLevel | The SyncLevel at which to acquire the mutex. |
| timeout | The timeout in clock ticks to wait for the mutex, or CLOCKS_NEVER to wait indefinitely. |
0. If timed out, 1. On failure, ERR and errno is set. Definition at line 94 of file mutex.c.
References aml_mutex_stack_push(), EINVAL, ERR, errno, mutex, and NULL.
Referenced by aml_def_acquire_read(), aml_field_unit_access(), and aml_method_evaluate().
| void aml_mutex_id_deinit | ( | aml_mutex_id_t * | mutex | ) |
Destroy the mutex with the given id.
| mutex | The mutex id to destroy. |
Definition at line 89 of file mutex.c.
References mutex.
Referenced by aml_object_clear().
| void aml_mutex_id_init | ( | aml_mutex_id_t * | mutex | ) |
Create a new mutex and return its id.
| mutex | The mutex id to initialize. |
Definition at line 84 of file mutex.c.
References atomic_fetch_add, mutex, and newMutexId.
Referenced by aml_method_set(), and aml_mutex_set().
| 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.
| mutex | The mutex to release. |
0. On failure, ERR and errno is set. Definition at line 114 of file mutex.c.
References aml_mutex_stack_pop(), EINVAL, ERR, errno, mutex, and NULL.
Referenced by aml_def_release_read(), aml_field_unit_access(), and aml_method_evaluate().