I want to protect access to a couple of shared variables (circular list
pointers).
they are declared as
volatile unsigned usRead, usWrite;
I have used the atomic_add / atomic _sub functions to write to the
variables.
Two questions:
1 - Is there any need to protect reads of these variables? Can a read of a
short be interrupted and somehow corrupted? (both threads that access the
buffer run at the same priority.
2 - Can / should I safely us a atomic_add_value to get the current value as
follows?
Value = atomic_add_value( &usRead, 0);