Low Pwr + IdleTask + TaskDelete() Question

I realize that  when using the TaskDelete() API call the IDLE task must have time to clean up delete task resources. However, if one added a IdleTaskHook to the IDLE task, does the IDLE task clean up the resources prior to invoking the hook method? For example (PIC32): void vApplicationIdleHook( void )
{
     // Idle task runs and clean up
     // delete task resource prior to
     // invoking this method?
     // Then enter low-power state
     PowerSaveIdle();
}

Low Pwr + IdleTask + TaskDelete() Question

Hopefully, this will clean up the code I posted…. void vApplicationIdleHook( void ) <br> { <br>// Idle task runs and clean up <br>// delete task resource prior to <br>// invoking this method? <br>// Then enter low-power state PowerSaveIdle(); <br>}

Low Pwr + IdleTask + TaskDelete() Question

Sorry, new to markdown syntax… void vApplicationIdleHook( void )
{
// Then enter low-power state
PowerSaveIdle();
}

Low Pwr + IdleTask + TaskDelete() Question

Seems if you add a tab as the first character on each code line then the code prints out with the wanted formatting. Regarding the idle task. The idle task does something like this void TheIdleTask( void* pv )
{
for(;;)
{
CleanUpDeletedResources();
CallIdleHook();
}
} This is simplified admittedly, but you cannot say which of the two function calls comes before the other because FreeRTOS is a pre-emptive system. It will start running from the place it last stopped running, which could be anywhere in its implementation. If it starts running just before CallIdleHook() then it will not have cleaned up the resources first, but it will do as soon as it leaves CallIdleHook().

Low Pwr + IdleTask + TaskDelete() Question

Hi Dave. The markdown syntax on SourceForge doesn’t seem to comply strictly with the spec in the link provided. I did eventually  figure out 4 (or more) spaces or a tab work,but there doesn’t seem to be a clean way to post indented code…that said, Thanks also for pointing out what I neglected to consider; that FreeRTOS will clean up the resources after if not before the power down mode is used due to preemption. What I wanted to nail down is if there is a more better or smarter way to enter idle without eating up resources, that is, assuming an application creates and distroys tasks frequenly.  This represents a 40% power savings in my case.  I ran the example (example 9 in Richard’s PIC32 FreeRTOS book) that deos creates and deletes a task in a tight loop overnight with no issues. This seems to confirm the validity of this technique unless anyone has any advice. Dave