Thank you Paul
I change turn to local variable as well.
http://cr.openjdk.java.net/~tyan/JDK-7027502/webrev.03/
<http://cr.openjdk.java.net/%7Etyan/JDK-7027502/webrev.03/>
I am not sure I understand your second suggestion here, sum up
thread_turns of each Context(This is a fixed value) doesn't equal
total_turns_taken.
Regards
Tristan
On 01/09/2014 06:28 PM, Paul Sandoz wrote:
On Jan 9, 2014, at 10:52 AM, Tristan Yan <tristan....@oracle.com> wrote:
Can someone else give a second review on this.
In a comment the bug you state: "here total_turns_taken is a static
variable, it could affect by other tests" I don't quite know under
what test circumstances that can happen, but if so is the following
also an issue: 52 private final static TurnChecker turn = new
TurnChecker(-1); ? FWIW an alternative to using an AtomicInteger would
be for the main loop to sum up thread_turns of each Context, since
read/writes are all performed in a synchronized block. Paul.