...
Declaring a variable as volatile or correctly synchronizing the code guarantees that 64-bit primitive variables of type long
and double
are accessed atomically (see CON25-J. Ensure atomicity when reading and writing 64-bit values for information on sharing long
and double
variables amongst multiple threads).
Noncompliant Code Example (non-volatile flag)
This noncompliant code example uses a shutdown()
method to set a non-volatile done
flag that is checked in the run()
method.
...
The following table summarizes the examples flagged as violations by SureLogic tools Flashlight:
Noncompliant Code Example | FlashLightFlagged | Message | JSure | Annotation | Message |
---|---|---|---|---|---|
non-static lock object for | Yes | Instance fields with empty locksets |
The following table summarizes the examples flagged as violations by SureLogic JSure:
Noncompliant Code Example | Flagged | Required Annotation | Message |
---|---|---|---|
non-volatile flag | Yes | @RegionLock("ControlledStop is this protects Instance") | Reports three issues: Lock "<this>:ControlledStop" not held when accessing (this.done), done = false and (this.done) |
...