vTaskSuspendAll question

I have several tasks that access common data. Is it OK to protect writes to the data using vTaskSuspendAll/xTaskResumeAll, but not reads to the data? I realize that it would be safer to protect both reads and writes, but it makes the coding much more complicated. Thanks

vTaskSuspendAll question

That depends a bit on the sort of data you have. If only writters use the protection then a reader might read a few words of memory, get interrupted by a writter, and then when it resumes the data has been changed from what it read before. If this is ok, then you are ok, if not, then you need better protection.

vTaskSuspendAll question

Thank you … that’s what I reckoned as the interrupt could happen at any machine instruction. Actually, I’m a bit embarrassed (and would like to apologise for asking the question) as this is well documented in the freeRTOS documentation … I should certainly have gone there first!