currently the IDLE_LOOP_HOOK is a function run by the idle thread.
However, it would be very interesting to have two other hooks:
1) IDLE_ENTRY_HOOK or IDLE_SCHEDULE_HOOK or ...
2) IDLE_EXIT_HOOK or IDLE_PREEMPT_HOOK or ...
that are called once when the idle thread is scheduled in, and when it's scheduled out.
This should be done in such a way that when the idle thread brings the processor in deep sleep, the exit hook is called when it comes out.
I have this on the end of my to-do list so if someone can steal this idea and implement it I buy you a beer next time I see you
Regards,
Leon.