Is it possible for one callback to interrupt another calback i.e. timer callback function being interrupted by a uart callback function (which is asynchronous) ??

If the answer is YES to the above is it possible to protect shared variables from being incorrectly updated. In PC programming there are “enter critical section/leave critical section” functions that can be used to protect variables in a multi-task OS enviroment.

Kind Regards,

Hi Danny,

I am pretty sure it is not possible!

It has been discussed in other places here and I have also made the experience that while a call back function does not return, the whole system is blocked. (And no oher call back functions are called…)

So, you should be safe without semaphore or similar constructs!

Best Regards,


Yes, while a call back function does not return the whole system is blocked. You must know that you should not wait more thant 4 or 4.5 seconds in a call back function because a wavecom WachDog timer will reboot the whole system.



well i suppose the same is applied to non-callback functions. For example, if my adl_main calls a function named UART1Open()
and this function for example calls the adl_fcmSubscribe and then waits activelly for a flag to be changed when the Control Handler is called with the ADL_FCM_EVENT_FLOW_OPENED, then this won’t work because the callback won’t be called till my UART1Open function returns.
Is this correct?

If it is, then there’s no chance to make a UARTOpen function which receives for example the baudrate, the number of the UART to be opened, flow control, … and returns 1 when all the actions related to its setup are performed and the flow is ready to use.

Best regards,

Hi Daniel,

it is exactly like that. You cannot do it this way! Your application needs to return control flow to the operating system so that it can do its processing.

In this system you cannot do a busy wait any place in the code… The condition you wait for will not change. Your application only has a single thread and the operating system requires the internal application to return control…

Best Regards,

Thanks jan for the reply,

so this is the Event World ! :smiley: It ain’t easy then to encapsulate things so that the code looks ‘platform independent’.