How to circumvent g_sf_power_profiles_v2_common.p_api->lowPowerApply (..StandBy..) after it has been entered?

Hi All,

I have a low power application where g_sf_power_profiles_v2_common.p_api->lowPowerApply (..StandBy..) is used.
Among other wake-up sources I use the RTC interval and an external interrupt connected to the RX line from a device with a Uart.

If, after the lowPowerApply() function is entered but before the CPU actually goes to sleep I get an interrupt,
the ISR will be called but the CPU will subsequently go to sleep when it hits the 

__WFI(); instruction  (which in my case is in ssp/src/driver/r_lpmv2_s5d9/hw/hw_plmv2_s5d9.c,  ssp_err_t HW_LPMV2_LowPowerModeEnter (void))

and won't wake up until the next interrupt occurs, and so, in short my board won't work properly.

A workaround: (untested)

Since, ssp/src/driver/r_lpmv2_s5d9/hw/hw_plmv2_s5d9.c on my platform is modifiable I could wrap the __WFI() in an if statement, thus

if(youGotaSignalSayinDontSleepDude == false)

A Better Solution: 


The Workaround above still has a small window where an interrupt would not cause the CPU to wake up.
Does anyone more knowledgeable than me have a better solution?


Many thanks.