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