# | Line 78 | Line 78 | public class AtomicReferenceTest extends | |
---|---|---|
78 | */ | |
79 | public void testCompareAndSetInMultipleThreads() throws Exception { | |
80 | final AtomicReference ai = new AtomicReference(one); | |
81 | < | Thread t = new Thread(new Runnable() { |
82 | < | public void run() { |
83 | < | while (!ai.compareAndSet(two, three)) Thread.yield(); |
84 | < | }}); |
81 | > | Thread t = new Thread(new CheckedRunnable() { |
82 | > | public void realRun() { |
83 | > | while (!ai.compareAndSet(two, three)) |
84 | > | Thread.yield(); |
85 | > | }}); |
86 | ||
87 | t.start(); | |
88 | assertTrue(ai.compareAndSet(one, two)); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |