Add UTASK_INIT

trunk
alexis 2023-02-05 16:32:31 -07:00
parent 7201f2ff76
commit c4760c282a
2 changed files with 11 additions and 0 deletions

View File

@ -43,6 +43,15 @@ typedef struct utask_s {
struct utask_arch_specific _arch;
} utask_t;
// Default initializers for the private members of utask_t. This is not
// necessary, but you can include this in definitions to keep the compiler
// from warning about uninitialized members.
#define UTASK_INIT \
._arg = 0, \
._next = NULL, \
._started = false, \
._arch = UTASK_ARCH_SPECIFIC_INIT,
// Get the next task after this one. Useful for traversing the task list.
#define UTASK_NEXT(t) ((t)->_next)

View File

@ -32,6 +32,8 @@ extern struct utask_arch_specific utask_ujb;
#define UTASK_ARCH_SPECIFIC_DEFS \
struct utask_arch_specific __attribute__((used)) utask_ujb;
#define UTASK_ARCH_SPECIFIC_INIT { 0, 0 }
void utask_riscv_start(uintptr_t arg, void * task, void * tas);
void utask_riscv_continue(void * tas);
void utask_riscv_yield(void * tas);