Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Redundant records in scheduler queue

When calling app_sched_event_put() no check is done whether the exact same record (same data, length and function pointer) already exists in the queue. We have setup where we put the UART events into the scheduler event queue, as the documentation says (sched_event_put(p_event, sizeof(p_event), te_uart_scheduler_event);).

However, we usually get a lot of events that are put into the queue that are identical. This means that we need to have a large queue in order not to lose other ("unique") events. Also, once app_sched_execute() is called, there will be a lot of unnecessary calls to the uart event function pointer.

Any thoughts about this?

Thanks, Jacob

Parents
  • app_scheduler has no mechanism to compare events in the queue. I think that it is application specific if same events is something welcomened or not.

    I would recommend following: use FIFO (e.g. nrf_queue or nrf_atfif) for storing new data and atomic flag. Atomic flag is set when event is put into app_scheduler and cleared when event is processed. When new event occurs, item is added to the FIFO and if flag is cleared then flag is set and app_scheduler event is scheduled. When processing function is called it processes data from the FIFO and clears the flag.

Reply
  • app_scheduler has no mechanism to compare events in the queue. I think that it is application specific if same events is something welcomened or not.

    I would recommend following: use FIFO (e.g. nrf_queue or nrf_atfif) for storing new data and atomic flag. Atomic flag is set when event is put into app_scheduler and cleared when event is processed. When new event occurs, item is added to the FIFO and if flag is cleared then flag is set and app_scheduler event is scheduled. When processing function is called it processes data from the FIFO and clears the flag.

Children
No Data
Related