1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
– |
import java.util.concurrent.atomic.*; |
9 |
|
import junit.framework.*; |
10 |
< |
import java.util.*; |
10 |
> |
import java.util.concurrent.atomic.AtomicLongFieldUpdater; |
11 |
|
|
12 |
|
public class AtomicLongFieldUpdaterTest extends JSR166TestCase { |
13 |
|
volatile long x = 0; |
93 |
|
assertEquals(-3,a.get(this)); |
94 |
|
} |
95 |
|
|
97 |
– |
|
96 |
|
/** |
97 |
|
* compareAndSet succeeds in changing value if equal to expected else fails |
98 |
|
*/ |
113 |
|
assertEquals(7,a.get(this)); |
114 |
|
} |
115 |
|
|
118 |
– |
|
116 |
|
/** |
117 |
|
* compareAndSet in one thread enables another waiting for value |
118 |
|
* to succeed |