zephyr/samples/userspace/shared_mem/src
Andy Ross 9e37e80a1d samples/userspace/shared_mem: Add volatile to interthread data
This test uses bare variables to synchronize state between threads,
but had forgotten volatile qualifiers on all the data.  So the
compiler was free to reorder and make assumptions that aren't valid
when the values are being written from other CPUs.

Single-cpu operation was fine because the code would always hit an
external function call like k_sleep() that would force it to re-read
from memory every time there was a context switch (timeslicing isn't
enabled on this test and the threads are cooperative), but on SMP the
volatiles can change at any time and we could see spurious state
mixups and hangs.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
..
enc.c style: samples/tests: add braces around if/while statements 2019-06-06 15:20:21 +02:00
enc.h samples/userspace/shared_mem: Add volatile to interthread data 2020-02-03 09:31:56 -05:00
main.c samples/userspace/shared_mem: Add volatile to interthread data 2020-02-03 09:31:56 -05:00
main.h cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00