|
CardSight 0.1.0
C API reference for the CardSight firmware and application
|
Counting semaphores. More...
Go to the source code of this file.
Data Structures | |
| struct | semaphore |
| A counting semaphore. More... | |
Functions | |
| void | sema_init_limit (struct semaphore *sem, uint32_t initial, uint32_t limit) |
| Initialize a counting semaphore. | |
| int | down_timeout (struct semaphore *sem, int timeout_ms) |
| Take one count from a semaphore. | |
| void | up (struct semaphore *sem) |
| Add one count to a semaphore. | |
Counting semaphores.
down_timeout() waits at most timeout_ms milliseconds and answers -ETIMEDOUT when the count did not arrive; a negative timeout waits forever.
| int down_timeout | ( | struct semaphore * | sem, |
| int | timeout_ms ) |
Take one count from a semaphore.
| [in] | sem | Semaphore to take from. |
| [in] | timeout_ms | Milliseconds to wait; negative waits forever, 0 does not wait. |
| void sema_init_limit | ( | struct semaphore * | sem, |
| uint32_t | initial, | ||
| uint32_t | limit ) |
Initialize a counting semaphore.
| [out] | sem | Semaphore structure to initialize. |
| [in] | initial | Initial count. |
| [in] | limit | Maximum count. |
| void up | ( | struct semaphore * | sem | ) |
Add one count to a semaphore.
| [in] | sem | Semaphore to release. |