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