Example usage for java.util.concurrent.atomic AtomicBoolean weakCompareAndSet

List of usage examples for java.util.concurrent.atomic AtomicBoolean weakCompareAndSet

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicBoolean weakCompareAndSet.

Prototype

@Deprecated(since = "9")
public boolean weakCompareAndSet(boolean expectedValue, boolean newValue) 

Source Link

Document

Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle#weakCompareAndSetPlain .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    AtomicBoolean atomicBoolean = new AtomicBoolean();

    atomicBoolean.weakCompareAndSet(true, true);

    System.out.println(atomicBoolean);
}