266 |
|
|
267 |
|
static final int COUNTDOWN = 100000; |
268 |
|
|
269 |
< |
class Counter implements Runnable { |
269 |
> |
class Counter extends CheckedRunnable { |
270 |
|
final AtomicIntegerArray ai; |
271 |
|
volatile int counts; |
272 |
|
Counter(AtomicIntegerArray a) { ai = a; } |
273 |
< |
public void run() { |
273 |
> |
public void realRun() { |
274 |
|
for (;;) { |
275 |
|
boolean done = true; |
276 |
|
for (int i = 0; i < ai.length(); ++i) { |
277 |
|
int v = ai.get(i); |
278 |
< |
threadAssertTrue(v >= 0); |
278 |
> |
assertTrue(v >= 0); |
279 |
|
if (v != 0) { |
280 |
|
done = false; |
281 |
|
if (ai.compareAndSet(i, v, v-1)) |