|
PatchworkOS
2ca1c69
A non-POSIX operating system.
|
Mutex. More...
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.
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. | |
| void aml_mutex_id_init | ( | aml_mutex_id_t * | mutex | ) |
| void aml_mutex_id_deinit | ( | aml_mutex_id_t * | mutex | ) |
| 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.
| 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.