This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How does the app schedule work?

Does it use the swi to guarantee the event realtime performance. What I need is, when an interrupt happen anytime, I just put an event to the schedule, and the schedule will handle this event. But is there any chance when the event just happen between the app_sched_execute and power_manage, then this event will be handled next wakeup.

  • Hi,

    The scheduler does not use software interrupts (SWI). It is essentially just a queue that you put events into. Then, you pop the queue and execute the event handlers by calling app_sched_execute() in the main loop before entering sleep by calling power_manage().

    In other words, the case you suggest where an interrupt occurs after the call to app_sched_execute() but before the device enters sleep will cause the event to not be handled until after the next wakeup. This may not be a significant issue though. If you have some time critical operations that need to be handled in a timely manner, then you can do that in the ISR, and move only the non-time critical work to the main context using the scheduler. (This is essentially what the scheduler is for - moving non-critical stuff to the main context so that the time critical interrupts are not being delayed by non-time critical operations running in interrupt priority.)

     

     

     

Related