* http://creativecommons.org/licenses/publicdomain
*/
-package java.util.concurrent.atomic;
-import sun.misc.Unsafe;
+//package java.util.concurrent.atomic;
+//import sun.misc.Unsafe;
/**
* A <tt>boolean</tt> value that may be updated atomically. See the
public class AtomicBoolean implements java.io.Serializable {
private static final long serialVersionUID = 4654671469794556979L;
// setup to use Unsafe.compareAndSwapInt for updates
- private static final Unsafe unsafe = Unsafe.getUnsafe();
+ /*private static final Unsafe unsafe = Unsafe.getUnsafe();
private static final long valueOffset;
static {
valueOffset = unsafe.objectFieldOffset
(AtomicBoolean.class.getDeclaredField("value"));
} catch (Exception ex) { throw new Error(ex); }
- }
+ }*/
private volatile int value;
* the actual value was not equal to the expected value.
*/
public final boolean compareAndSet(boolean expect, boolean update) {
- int e = expect ? 1 : 0;
+ /*int e = expect ? 1 : 0;
int u = update ? 1 : 0;
- return unsafe.compareAndSwapInt(this, valueOffset, e, u);
+ return unsafe.compareAndSwapInt(this, valueOffset, e, u);*/
+ System.out.println("Unimplemented AtomicBoolean.compareAndSet()");
+ return false;
}
/**
* @return true if successful.
*/
public boolean weakCompareAndSet(boolean expect, boolean update) {
- int e = expect ? 1 : 0;
+ /*int e = expect ? 1 : 0;
int u = update ? 1 : 0;
- return unsafe.compareAndSwapInt(this, valueOffset, e, u);
+ return unsafe.compareAndSwapInt(this, valueOffset, e, u);*/
+ System.out.println("Unimplemented AtomicBoolean.weakCompareAndSet()");
+ return false;
}
/**
*/
public final void lazySet(boolean newValue) {
int v = newValue ? 1 : 0;
- unsafe.putOrderedInt(this, valueOffset, v);
+ //unsafe.putOrderedInt(this, valueOffset, v);
+ System.out.println("Unimplemented AtomicBoolean.lazySet()");
}
/**
* Returns the String representation of the current value.
* @return the String representation of the current value.
*/
- public String toString() {
+ /*public String toString() {
return Boolean.toString(get());
- }
+ }*/
}