Since the task you describe has only a single context switch, by default that's where it must stop and resume when OSStopTask() and OSStartTask() operate on it. IOW, a task's entry points are its beginning and each context switch, and its exit points are each context switch.
I suspect your best bet would be to use a global static variable that contains info on how you would like the task to behave when it is restarted. This variable is initialized prior to creating the task, and is read after OS_Delay(), with the task's execution dependent on its value. You could do something like:
code:OS_Delay(label);
switch ( behavior ) {
case CONTINUE:
break;
case RESTART:
goto top_of_task_A;
case DELAY_AGAIN:
goto just_before_OSDelay;
default:
break;
}
where you might set behavior to RESTART prior to calling OSStartTask();
Alternatively, you could call OSStopTask(), then OSCreateTask(), re-creating the same task in its place. Note that in this case the task's initial code (before the while(1) loop) will be executed.
------------------