# AVR diagram of functions calling, ISR and main loop share the same resource

I made a simple diagram of functions calls to illustrate the potential problem which bothering me a little. As you can see, my task_list (which is simple linked list) is modified either in ISR and program main loop.

• Can this solution cause errors in the future?
• What kind of errors?
• Should I use some kind of synchronization/resource protection solutions to prevent errors?
• What kind of synchronization?

• This is a little bit odd as an architecture; typically you don't have an ISR putting tasks on a queue, rather you have an ISR changing task to implement a scheduler, otherwise you have cooperative multi-tasking in the sense that you only switch when a task complete or yields. At any rate, you likely do need locking. But more importantly, you should spend some time studying how this is usually done... – Chris Stratton Sep 4 at 21:43