ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AtomicIntegerTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AtomicIntegerTest.java (file contents):
Revision 1.15 by jsr166, Tue Nov 17 03:12:51 2009 UTC vs.
Revision 1.16 by jsr166, Tue Nov 17 06:58:50 2009 UTC

# 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));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines