Examples of weakCompareAndSet()


Examples of java.util.concurrent.atomic.AtomicBoolean.weakCompareAndSet()

    }

    @Test
    public void weakCompareAndSet() throws Exception {
        AtomicBoolean value = new AtomicBoolean();
        assert value.weakCompareAndSet(false, true);

        value.set(true);
        assert !value.weakCompareAndSet(false, false);
    }
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicBoolean.weakCompareAndSet()

    public void weakCompareAndSet() throws Exception {
        AtomicBoolean value = new AtomicBoolean();
        assert value.weakCompareAndSet(false, true);

        value.set(true);
        assert !value.weakCompareAndSet(false, false);
    }

    @Test
    public void lazySet() throws Exception {
        AtomicBoolean value = new AtomicBoolean();
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet()

    }

    @Test
    public void weakCompareAndSet() throws Exception {
        AtomicInteger value = new AtomicInteger();
        assert value.weakCompareAndSet(0, 10);
        assert value.get() == 10;

        assert !value.weakCompareAndSet(20, 30);
        assert value.get() == 10;
    }
View Full Code Here

Examples of java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet()

    public void weakCompareAndSet() throws Exception {
        AtomicInteger value = new AtomicInteger();
        assert value.weakCompareAndSet(0, 10);
        assert value.get() == 10;

        assert !value.weakCompareAndSet(20, 30);
        assert value.get() == 10;
    }

    @Test
    public void lazySet() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.