SharedPointer (FB)¶
FUNCTION_BLOCK PUBLIC FINAL SharedPointer EXTENDS FBF.InstanceBase IMPLEMENTS ISharedPointer, ISharedArea
Models a reference to a memory location that can be consistently shared by tasks on different cores.
The size of the memory location is 32 bit or 64 bit wide (see: __XWORD
).
This depends on the architecture of the processor and the settings of the code generator.
This kind of pointer implements additionally an modification counter
and this will be modified with any change of the pointer address.
With this the so called ABA problem will be avoided.
In multi tasking/core environment, the ABA problem occurs during synchronization, when a memory location is read twice, has the same value for both reads, and “value is the same” is used to indicate “nothing has changed”. However, another task can execute between the two reads and change the value, do other work, then change the value back, thus fooling the first task into thinking “nothing has changed” even though the second thread did work that violates that assumption.
- InOut:
Scope
Name
Type
Comment
Input Const
pAddress
__XWORD
The initial memory location, this pointer should pointing to
Properties:
Methods:
Structure: