Wake up main thread on any interrupt

Hi,

Is there a way to make the main thread to execute after any interrupt? 

For now, I have something like this (ncs 2.7.0): 

in main thread : 

for(;;)
{
    // execute code
    k_sleep(K_FOREVER);
}

In each IRQ handlers (gpio, timers...) 

irq_handler
{
    k_wakeup(mainThreadID);
}

I think that this is error prone, as I can't be sure to fill all handlers, and it could be hard to maintain. Also, what about the native handler I didn't overwrite? 

Is there a way to have a general irq_handler or a hook that could be executed on ANY interrupt, in addition to other regular handlers?

The whole point here is to replace the WFE() instruction I had in a bare metal application.

Thank you for your help

Related