HALFRED  0.4.0
hal_os_task.h
Go to the documentation of this file.
1 
10 #ifndef HAL_OS_TASK_H
11 #define HAL_OS_TASK_H
12 
13 #include <stddef.h>
14 #include <stdbool.h>
15 
223 
225 typedef int (*OSTaskFunction)(void* arg);
226 
228 typedef enum {
240 
241 #define HAL_OSTASK_BASIC 0
242 #define HAL_OSTASK_JOINABLE 1
243 #define HAL_OSTASK_MORTAL 2
244 #define HAL_OSTASK_SLEEPY 4
245 
247 struct OSTaskDesc;
249 typedef struct OSTaskDesc* OSTask;
250 
262 OSTask OSTASK_Create(OSTaskFunction taskFunc, int features, OSTaskPriority priority, size_t stack_size, void* arg);
263 
273 bool OSTASK_IsValid(OSTask task);
274 
280 bool OSTASK_IsJoinable(OSTask task);
281 
287 bool OSTASK_IsMortal(OSTask task);
288 
294 bool OSTASK_IsSleepy(OSTask task);
295 
307 bool OSTASK_Join(OSTask task, OSTime timeout, int* result);
308 
314 void OSTASK_Kill(OSTask task);
315 
326 bool OSTASK_IsAlive();
327 
335 void OSTASK_Wakeup(OSTask task);
336 
346 bool OSTASK_SleepIfNotWoken(OSTime maxSleepTime);
347 
353 void OSTASK_Destroy(OSTask task);
354 
360 bool OSTASK_Suspend(OSTask task);
361 
367 bool OSTASK_Resume(OSTask task);
368 
372 void OSTASK_Yield(void);
373 
381 
389 bool OSTASK_SetPriority(OSTask task, OSTaskPriority priority);
390 
395 OSTask OSTASK_GetCurrentTask(void);
396 
404 #endif // HAL_OS_TASK_H
void OSTASK_Yield(void)
bool OSTASK_IsSleepy(OSTask task)
priority higher than normal
Definition: hal_os_task.h:236
Definition of an OSTask descriptor.
Definition: hali_os_task.h:14
bool OSTASK_SetPriority(OSTask task, OSTaskPriority priority)
bool OSTASK_IsJoinable(OSTask task)
int(* OSTaskFunction)(void *arg)
Type that defines the task function.
Definition: hal_os_task.h:225
bool OSTASK_IsMortal(OSTask task)
bool OSTASK_SleepIfNotWoken(OSTime maxSleepTime)
bool OSTASK_Suspend(OSTask task)
void OSTASK_Wakeup(OSTask task)
void * arg
task argument
Definition: hali_os_task.h:20
OSTaskPriority
Possible task priorities.
Definition: hal_os_task.h:228
bool OSTASK_Resume(OSTask task)
OSTaskFunction taskFunc
task implementation func
Definition: hali_os_task.h:18
int features
task features
Definition: hali_os_task.h:24
struct OSTaskDesc * OSTask
Type describing task handle that identifies a task.
Definition: hal_os_task.h:249
highest priority (possibly most real-time)
Definition: hal_os_task.h:238
int result
task result
Definition: hali_os_task.h:22
OSTask OSTASK_GetCurrentTask(void)
OSTask OSTASK_Create(OSTaskFunction taskFunc, int features, OSTaskPriority priority, size_t stack_size, void *arg)
bool OSTASK_Join(OSTask task, OSTime timeout, int *result)
void OSTASK_Destroy(OSTask task)
low priority
Definition: hal_os_task.h:234
lowest priority
Definition: hal_os_task.h:232
bool OSTASK_IsAlive()
normal priority (default)
Definition: hal_os_task.h:230
void OSTASK_Kill(OSTask task)
bool OSTASK_IsValid(OSTask task)
OSTaskPriority OSTASK_GetPriority(OSTask task)