Fixed test with atomic
the --task was not protected with a memory barrier, so different producing threads could contend on the field. Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
f34f23f20f
commit
a810ecf67e
|
@ -156,11 +156,11 @@ public class ExecutionStrategyTest
|
||||||
|
|
||||||
Producer producer = new TestProducer()
|
Producer producer = new TestProducer()
|
||||||
{
|
{
|
||||||
int tasks=TASKS;
|
AtomicInteger tasks = new AtomicInteger(TASKS);
|
||||||
@Override
|
@Override
|
||||||
public Runnable produce()
|
public Runnable produce()
|
||||||
{
|
{
|
||||||
final int id = --tasks;
|
final int id = tasks.decrementAndGet();
|
||||||
if (id>=0)
|
if (id>=0)
|
||||||
{
|
{
|
||||||
while(_threads.isRunning())
|
while(_threads.isRunning())
|
||||||
|
|
Loading…
Reference in New Issue