Handlers "priority" within single task

HI,

I couldn’t get the information from the API documentation, how exactly handlers are prioritized.

I’m having a single task app, that subscribes to multiple timers, UART FCM service, AT commands reponse handlers, sim etc etc etc - a huge, single task.

I wonder if there is any priority how handlers are called within the same task context. Is there any “interrupt” or “pre-emtpion” process within this context or all those callback functions are served in a FIFO manner?

If e.g. UART handler is called, would it interrupt current timer handler? Or would it wait until the handler is finished and then proceed? Or if two handlers are called at the same time or are awaiting execution - which one would be chosen for execution?

Any help or a pointer to documentation would be helpful.
regards

yes, there would be pre-emptions.I believe you can use hardware timers… they are strict…

Rex_alex - you mean pre-emptions of what exactly?

The API guide says timer handler call could be delayed if the application is pre-empted (by i.e. high level interrupt task), but since everything is happening in the main task (no irqs and hw timers) - what would cause the preemption?

I suspect that the “task scheduler” is just running through the structures /tables with registered tmrs and other handlers checking for makred events and calling the apopriate functions. This would mean that there is some kind of priority of callback functions (the one “lower” in table or subscribed earlier will be called first), but generally they wouldn’t pre-empt other handlers and the user can’t really control this functionality. This is somehow reasonable for an OS to do so.

The bottom question was really how to do an atomic operation in OAT if the handlers pre-empt or interrupt each other within single context…

regards

yes, hardware interrupts are given more priority than software interrupts… so premtion would be there…

so if some software interrupt is going on and some hardware interrup comes, that should be services first.

Hiya,

ADL provides semaphores in the API. Maybe you could use a semaphore to do an atomic operation? Have a look at adl_semSubscribe() etc in the ADL doco.

ciao, Dave

Guys, thanks for your inputs, but the point is still “missed”…

Let’s focus on software timers, to which I subscribe in a single task - is there any prority they will be executed with? Would one software timer’s handler have higher priority over the other in case two timers expire at the same time?

If the handler is an “interrupt-like” - it would be called as the timer expires and there would be some mechanism to serve multiple such events.

If the handler is a separate “task” with the same context as the caller function - there would have been some rules on how these asynchronous events happen, how do they delay execution of other handlers etc etc etc.

Basically - is there a Linux-type-signal-handling underneath or something else?