|
CardSight 0.1.0
C API reference for the CardSight firmware and application
|
Mutexes. More...
Go to the source code of this file.
Data Structures | |
| struct | mutex |
| A sleeping mutual-exclusion lock. More... | |
Macros | |
| #define | WAIT_FOREVER (-1) |
| Negative timeout: wait without a bound. | |
| #define | NO_WAIT 0 |
| Timeout of zero: take the lock only when it is free. | |
Functions | |
| void | mutex_init (struct mutex *lock) |
| Initialize a mutex. | |
| int | mutex_lock_timeout (struct mutex *lock, int timeout_ms) |
| Take a mutex, waiting at most a bounded time. | |
| void | mutex_unlock (struct mutex *lock) |
| Release a mutex. | |
Mutexes.
WAIT_FOREVER (a negative timeout) waits without a bound; NO_WAIT takes the lock only when it is free. Like every mutex, the task that takes it must be the one that releases it.
| void mutex_init | ( | struct mutex * | lock | ) |
Initialize a mutex.
| [out] | lock | Mutex structure to initialize. |
| int mutex_lock_timeout | ( | struct mutex * | lock, |
| int | timeout_ms ) |
Take a mutex, waiting at most a bounded time.
| [in] | lock | Mutex to take. |
| [in] | timeout_ms | Milliseconds to wait; negative waits forever, 0 does not wait. |
| void mutex_unlock | ( | struct mutex * | lock | ) |
Release a mutex.
| [in] | lock | Mutex to release; must be held by the calling task. |