Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

void  OSTaskReturnHook (void);

File

Called from

Code enabled by

os_cpu_c.c

...

...

OS_TaskReturn() ONLY

...

...

N/A

...

1005329This function is called by OS_TaskReturn(). OS_TaskReturn() is called if the user accidentally returns from the task code. In other words, the task should either be implemented as an infinite loop and never return, or the task must call OSTaskDel((OS_TCB *)0, &err) to delete itself to prevent it from exiting.

Anchor10053311005331OSTaskReturnHook() is part of the CPU port code and this function must not be called by the application code. OSTaskReturnHook() is actually used by the µC/OS-III port developer. Anchor10053321005332

Note that after calling OSTaskReturnHook(), OS_TaskReturn() will actually delete the task by calling: Anchor10053331005333

OSTaskDel((OS_TCB *)0,

...

          &err)

...

...

Arguments

Anchor10053361005336p_tcb Anchor10053371005337

is a pointer to the TCB of the task that is not behaving as expected. Note that the OS_TCB is validated by OS_TaskReturn(), and is guaranteed to not be a NULL pointer when OSTaskReturnHook() is called.

...

...

Returned Value

...

Noneanchor10053401005340

Notes/Warnings

...

Do not call this function from the application. Anchor10053421005342

Example

...

The code below calls an application-specific hook that the application programmer can define. For this, the user can simply set the value of OS_AppTaskReturnHookPtr to point to the desired hook function as shown in the example. If a task returns and forgets to call OSTaskDel((OS_TCB *)0, &err) then µC/OS-III will call OSTaskReturnHook() which in turns calls App_OS_TaskReturnHook() through OS_AppTaskReturnHookPtr. When called, the application hook is passed the address of the OS_TCB of the task returning. Anchor10692631069263  

...

rowspan4

...

.

...