From Niklas Holsti@21:1/5 to Rod Kay on Fri May 12 20:38:29 2023
On 2023-05-12 15:17, Rod Kay wrote:
Surely only the least significant bit of the least significant byte
is relevant and so the value cannot be garbled by one task writing and another reading at the same time ?
That seems very likely indeed, unless (as others have commented) the representation has been specified to use more bits. However, the Ada RM
states in C.6(8/3) that "every atomic type or object is also defined to
be volatile", and of course Boolean variables are not considered
volatile unless they are specified to be Atomic or Volatile. So a
Boolean type is not inherently atomic in the Ada RM sense of "atomic".
And of course if you use a shared variable to communicate data between
tasks, that variable should be marked as Volatile, and there should also
be some Atomic accesses to ensure that actions are "sequential", so
marking the variable as Atomic is best.