Mutex required?

willywortel wrote on Sunday, January 25, 2009:

When i have multiple tasks that reads out data from a variable, and only one task writes to a variable.
Is it safer/better to use a mutex?

It is about a 32bit variable on a 32bit processor.

edwards3 wrote on Sunday, January 25, 2009:

One writer and multiple readers does not require a mutex, provided the write/read is atomic. A 32bit write on a 32bit processor should be atomic, so you are ok.

alainm3 wrote on Monday, January 26, 2009:

Take care that on some architectures this cannot be taken for granted. As an example on a Cortex you can have a 32 bit variable that is not 32 bit aligned, extra aligment definition may be needed. fwik on ARM7 it is always aligned, someone please confirm this :wink: