Defines a group of APIs, which interface to RTOS semaphore functionality contained in ROM.
More...
Defines a group of APIs, which interface to RTOS semaphore functionality contained in ROM.
Semaphores are primarily utilized for synchronization between threads. Asynchronous events can be triggered across threads because a semaphore can be incremented or decremented by any thread.
- Note
- This is set of APIs implements a counting semaphore.
wiced_semaphore_t* wiced_rtos_create_semaphore |
( |
void |
| ) |
|
Allocates memory for a new semaphore instance and returns the pointer.
Once created, the semaphore must be initialized before use by calling wiced_rtos_init_semaphore .
- Parameters
-
- Returns
- NULL an error occurred and the instance was not allocated, do not init
- valid pointer to samphore instance, which can now we initialized
wiced_result_t wiced_rtos_get_semaphore |
( |
wiced_semaphore_t * |
semaphore, |
|
|
uint32_t |
timeout_ms |
|
) |
| |
Attempts to get (wait/decrement) a semaphore.
If semaphore is at zero already, then the calling thread will be suspended until another thread sets the semaphore with wiced_rtos_set_semaphore
- Parameters
-
[in] | semaphore | pointer to semaphore instance |
[in] | timeout_ms | milliseconds to wait for semaphore |
- Returns
- WICED_SUCCESS
- WICED_ERROR
wiced_result_t wiced_rtos_init_semaphore |
( |
wiced_semaphore_t * |
semaphore | ) |
|
Initializes a counting semaphore created by wiced_rtos_create_semaphore.
- Parameters
-
[in] | semaphore | pointer to semaphore instance |
- Returns
- WICED_SUCCESS
- WICED_ERROR
wiced_result_t wiced_rtos_set_semaphore |
( |
wiced_semaphore_t * |
semaphore | ) |
|
Set (post/put/increment) a semaphore.
- Parameters
-
[in] | semaphore | pointer to semaphore instance |
- Returns
- WICED_SUCCESS
- WICED_ERROR