AIROC™ BTSDK v4.8 - Documentation | ||||
Defines a group of APIs which enable the use of worker threads. More...
Functions | |
wiced_worker_thread_t * | wiced_rtos_create_worker_thread (void) |
Allocates memory for a new worker thread instance and returns the pointer. More... | |
wiced_result_t | wiced_rtos_init_worker_thread (wiced_worker_thread_t *worker_thread, uint8_t priority, uint32_t stack_size, uint32_t event_queue_size) |
Initializes the worker thread instance that was allocated in wiced_rtos_create_worker_thread. More... | |
wiced_result_t | wiced_rtos_send_asynchronous_event (wiced_worker_thread_t *worker_thread, event_handler_t function, void *arg) |
Enqueue an asynchronous event to be triggered in the given worker thread. More... | |
Defines a group of APIs which enable the use of worker threads.
Each thread can be created with its own stack size, priority, and task queue size. In the work thread, the only way to execute code is to enqueue a new task and have it execute a callback.
wiced_worker_thread_t* wiced_rtos_create_worker_thread | ( | void | ) |
Allocates memory for a new worker thread instance and returns the pointer.
The created instance must be initialized using wiced_rtos_init_worker_thread before use.
void |
wiced_result_t wiced_rtos_init_worker_thread | ( | wiced_worker_thread_t * | worker_thread, |
uint8_t | priority, | ||
uint32_t | stack_size, | ||
uint32_t | event_queue_size | ||
) |
Initializes the worker thread instance that was allocated in wiced_rtos_create_worker_thread.
The worker thread creates a regular RTOS thread with the given stack size and priority, as well as an RTOS queue. The created thread blocks indefinitely until a task in enqueued. The task is dequeued and executed in the worker thread context, then the thread loops back around to wait for the next task.
[in] | worker_thread | worker thread instance to init |
[in] | priority | thread priority |
[in] | stack_size | thread's stack size in number of bytes |
[in] | event_queue_size | number of events the task queue can hold |
wiced_result_t wiced_rtos_send_asynchronous_event | ( | wiced_worker_thread_t * | worker_thread, |
event_handler_t | function, | ||
void * | arg | ||
) |
Enqueue an asynchronous event to be triggered in the given worker thread.
[in] | worker_thread | worker thread instance to which the event is sent |
[in] | function | callback function executed in worker thread |
[in] | arg | argument passed to the callback function |