9 #ifndef MICROEJ_ASYNC_WORKER_H 10 #define MICROEJ_ASYNC_WORKER_H 128 MICROEJ_ASYNC_WORKER_OK,
129 MICROEJ_ASYNC_WORKER_ERROR,
130 MICROEJ_ASYNC_WORKER_INVALID_ARGS
174 int32_t params_sizeof;
175 int32_t waiting_threads_length;
176 int32_t* waiting_threads;
177 uint16_t waiting_thread_offset;
178 uint16_t free_waiting_thread_offset;
179 OSAL_queue_handle_t jobs_queue;
180 OSAL_task_handle_t task;
181 OSAL_mutex_handle_t mutex;
194 #define MICROEJ_ASYNC_WORKER_worker_declare(_name, _job_count, _param_type, _waiting_list_size)\ 195 _param_type _name ## _params[_job_count];\ 196 MICROEJ_ASYNC_WORKER_job_t _name ## _jobs[_job_count];\ 197 int32_t _name ## _waiting_threads[_waiting_list_size+1];\ 198 MICROEJ_ASYNC_WORKER_handle_t _name = {\ 199 .job_count = _job_count,\ 200 .free_jobs = _name ## _jobs,\ 201 .params = _name ## _params,\ 202 .params_sizeof = sizeof(_param_type),\ 203 .waiting_threads_length = _waiting_list_size+1,\ 204 .waiting_threads = _name ## _waiting_threads,\ 205 .waiting_thread_offset = 0,\ 206 .free_waiting_thread_offset = 0\ 332 #endif // MICROEJ_ASYNC_WORKER_H MICROEJ_ASYNC_WORKER_status_t MICROEJ_ASYNC_WORKER_async_exec(MICROEJ_ASYNC_WORKER_handle_t *async_worker, MICROEJ_ASYNC_WORKER_job_t *job, MICROEJ_ASYNC_WORKER_action_t action, SNI_callback on_done_callback)
Executes the given job asynchronously.
MICROEJ_ASYNC_WORKER_job_t * MICROEJ_ASYNC_WORKER_get_job_done(void)
Returns the job that has been executed.
void(* MICROEJ_ASYNC_WORKER_action_t)(MICROEJ_ASYNC_WORKER_job_t *job)
Pointer to a function to call asynchronously.
void * params
Pointers to the parameters.
A job to execute in a worker.
MICROEJ_ASYNC_WORKER_status_t MICROEJ_ASYNC_WORKER_async_exec_no_wait(MICROEJ_ASYNC_WORKER_handle_t *async_worker, MICROEJ_ASYNC_WORKER_job_t *job, MICROEJ_ASYNC_WORKER_action_t action)
Executes the given job asynchronously.
MICROEJ_ASYNC_WORKER_status_t
Return codes list.
struct MICROEJ_ASYNC_WORKER_job::@0 _intern
Structure internal data. Must not be modified.
MICROEJ_ASYNC_WORKER_status_t MICROEJ_ASYNC_WORKER_free_job(MICROEJ_ASYNC_WORKER_handle_t *async_worker, MICROEJ_ASYNC_WORKER_job_t *job)
Frees a job previously allocated with MICROEJ_ASYNC_WORKER_allocate_job().
MICROEJ_ASYNC_WORKER_job_t * MICROEJ_ASYNC_WORKER_allocate_job(MICROEJ_ASYNC_WORKER_handle_t *async_worker, SNI_callback sni_retry_callback)
Allocates a new job for the given worker.
MICROEJ_ASYNC_WORKER_status_t MICROEJ_ASYNC_WORKER_initialize(MICROEJ_ASYNC_WORKER_handle_t *async_worker, uint8_t *name, OSAL_task_stack_t stack, int32_t priority)
Initializes and starts a worker previously declared with MICROEJ_ASYNC_WORKER_worker_declare() macro...