On Mon, Jan 24, 2022 at 10:46:17PM +0800, Tao Zhou wrote: > > +/** > > + * sys_umcg_wait: transfer running context > > + * > > + * Called like: > > + * > > + * self->state = UMCG_TASK_RUNNABLE | UMCG_TF_COND_WAIT; > > + * ... > > + * sys_umcg_wait(0, time); > > + * > > + * The syscall will clear TF_COND_WAIT and wait until state becomes RUNNING. > > + * The code '...' must not contain syscalls > > + * > > + * If self->next_tid is set and indicates a valid UMCG task with RUNNABLE state > > + * that task will be made RUNNING and woken -- transfering the running context > > + * to that task. In this case self->next_tid is modified with TID_RUNNING to > > + * indicate self->next_tid is consumed. > > + * > > + * If self->next has TID_RUNNING set, it is validated the related task has > > /self->next/self->next_tid/ Yeah, there's more of that, I'll be sure to go re-read all the comments.