I need some knowledgement or source about this 2 topic.
The best way to be thread safe, in my case.
I like to exit an interrupt in under 3uSeconds. <- this is the main issue.
That way, there is never any latency.
In the interrupt, I have a results buffer Table. with incoming and outgoing pointers.
The result(s) is/are saved and the incoming pointer incremented/wrapped in circular buffer.
In the interrupt, if the Table is already full then is sets an overflow error flag.
In the foreground or controlling process, the Outgoing pointers are used to read the results in consecutive order.
if the overflow flag is set, the foreground process, must manage/report the issue.
Retrieving data ...