LAR Library: task.h Source File

LAR Library

task.h
Go to the documentation of this file.
1 #ifndef LARLIB_TASK_H
2 #define LARLIB_TASK_H
3 
167 #include <larlib/base.h>
168 
170 #define TASK_INFINITE_TIMEOUT (0xFFFFFFFFLU)
171 
175 typedef struct taskThread_t taskThread_t;
176 
181 typedef void (*taskThreadFunction_t)(void *param);
182 
186 typedef struct taskQueue_t taskQueue_t;
187 
192 
196 typedef struct taskEvent_t taskEvent_t;
197 
210 taskThread_t *taskThreadCreate(taskThreadFunction_t fn, void *param, uint32_t stackSize);
211 
220 void taskSleep(uint32_t timeout);
221 
227 
233 taskQueue_t *taskQueueCreate(int maxItems);
234 
245 
264 int taskQueuePost(taskQueue_t *q, void *item);
265 
288 int taskQueuePop(taskQueue_t *q, void **item, uint32_t timeout);
289 
299 
309 
324 
334 
345 
376 
384 
399 
415 
431 int taskEventWait(taskEvent_t *e, uint32_t timeout);
432 
458 int taskEventWaitAny(taskEvent_t *events[], int nevents, uint32_t timeout);
459 
476 
477 /* @} */
478 
479 #endif
taskQueue_t * taskQueueCreate(int maxItems)
Create a new queue with up to maxItems allowed.
int taskEventSignal(taskEvent_t *e)
Set an event to the signaled state.
int taskEventWaitAny(taskEvent_t *events[], int nevents, uint32_t timeout)
Wait for at least one among a list of events to be signaled.
taskEvent_t * taskEventCreate(void)
Create a new event handler.
void taskSleep(uint32_t timeout)
Sleep the current running thread.
struct taskQueue_t taskQueue_t
Handle to a multi-threading queue.
Definition: task.h:186
taskThread_t * taskThreadCreate(taskThreadFunction_t fn, void *param, uint32_t stackSize)
Create a new execution thread with entry point fn.
taskSemaphore_t * taskSemaphoreCreate(int limit)
Create a semaphore with a maximum entry count of limit.
struct taskSemaphore_t taskSemaphore_t
Handle to a semaphore.
Definition: task.h:191
int taskQueuePop(taskQueue_t *q, void **item, uint32_t timeout)
Extract the element from the front of the queue.
void(* taskThreadFunction_t)(void *param)
Type of a function pointer to be used as entry point of a new thread.
Definition: task.h:181
void taskEventDestroy(taskEvent_t *e)
Release the resources associated with an event handler.
struct taskThread_t taskThread_t
A handle to a running thread.
Definition: task.h:175
void taskQueueDestroy(taskQueue_t *q)
Destroy a queue and discards all pending elements.
taskThread_t * taskThreadCurrent(void)
Return the handle of the current running thread.
int taskEventWait(taskEvent_t *e, uint32_t timeout)
Wait for e to change to signaled state.
unsigned int uint32_t
Unsigned 32-bit integer.
Definition: base.h:168
struct taskEvent_t taskEvent_t
Handle to an event.
Definition: task.h:196
int taskQueuePost(taskQueue_t *q, void *item)
Insert an element on the back of the queue q.
int taskEventCheck(taskEvent_t *e)
Check if an event if signaled, without waiting or clearing the signal.
Larlib basic definitions.
int taskEventClear(taskEvent_t *e)
Set an event as non-signaled.
taskEvent_t * taskEventCreateSystem(uint32_t bitmask)
Creates an event handler to wait for system peripheral events.
int taskSemaphoreAcquire(taskSemaphore_t *s, uint32_t timeout)
Acquire (also called wait or down) the semaphore.
void taskSemaphoreDestroy(taskSemaphore_t *s)
Destroy an existing semaphore.
int taskSemaphoreRelease(taskSemaphore_t *s)
Release (also called signal or up) a previously acquired semaphore.
Generated on Mon Mar 27 2017 15:42:52 for LAR Library by   doxygen 1.8.9.1