zephyr/samples/userspace
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
..
prod_consumer samples/userspace/prod_consumer: Fix main() type 2019-12-16 11:27:56 +01:00
shared_mem samples/userspace/shared_mem: Add volatile to interthread data 2020-02-03 09:31:56 -05:00
index.rst