public class GammaTxnBoolean extends BaseGammaTxnRef implements TxnBoolean
TxnBoolean
for the GammaStm
.long_value, ref_value, type
___unsafe, identityHashCode, listeners, listenersOffset, MASK_OREC_EXCLUSIVELOCK, MASK_OREC_READBIASED, MASK_OREC_READLOCKS, MASK_OREC_READONLY_COUNT, MASK_OREC_SURPLUS, MASK_OREC_UPDATELOCK, orec, stm, valueOffset, version
FAILURE, MASK_CONFLICT, MASK_SUCCESS, MASK_UNREGISTERED, REGISTRATION_DONE, REGISTRATION_NONE, REGISTRATION_NOT_NEEDED, TRANLOCAL_COMMUTING, TRANLOCAL_CONSTRUCTING, TRANLOCAL_READ, TRANLOCAL_WRITE, TRANSACTIONTYPE_FAT_FIXED_LENGTH, TRANSACTIONTYPE_FAT_MONO, TRANSACTIONTYPE_FAT_VARIABLE_LENGTH, TRANSACTIONTYPE_LEAN_FIXED_LENGTH, TRANSACTIONTYPE_LEAN_MONO, TX_ABORTED, TX_ACTIVE, TX_COMMITTED, TX_PREPARED, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_INT, TYPE_LONG, TYPE_REF, VERSION_UNCOMMITTED
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED
Constructor and Description |
---|
GammaTxnBoolean(boolean value) |
GammaTxnBoolean(GammaStm stm) |
GammaTxnBoolean(GammaStm stm,
boolean b) |
GammaTxnBoolean(GammaTxn tx) |
GammaTxnBoolean(GammaTxn tx,
boolean value) |
Modifier and Type | Method and Description |
---|---|
boolean |
alter(GammaTxn tx,
BooleanFunction function,
boolean returnOld) |
boolean |
alterAndGet(BooleanFunction function)
Alters the value stored in this Ref using the provided function and returns the result.
|
boolean |
alterAndGet(GammaTxn tx,
BooleanFunction function) |
boolean |
alterAndGet(Txn tx,
BooleanFunction function)
Alters the value stored in this Ref using the provided function and lifting on the provided txn.
|
boolean |
atomicAlterAndGet(BooleanFunction function)
Atomically applies the function to the current value in this ref and returns the new value.
|
boolean |
atomicCompareAndSet(boolean expectedValue,
boolean newValue)
Executes a compare and set atomically.
|
boolean |
atomicGet()
Atomically gets the value.
|
boolean |
atomicGetAndAlter(BooleanFunction function)
Atomically applies the function to alter the value stored in this ref and returns the old value.
|
boolean |
atomicGetAndSet(boolean newValue)
Atomically sets the value and returns the previous value.
|
boolean |
atomicSet(boolean newValue)
Atomically sets the value and returns the new value.
|
String |
atomicToString()
Returns a String representation of the object using the provided transaction without looking
at a
TxnThreadLocal . |
boolean |
atomicWeakGet()
Atomically gets the value without providing any ordering guarantees.
|
void |
await(boolean value)
Awaits for the value to become the given value.
|
void |
await(BooleanPredicate predicate)
Awaits until the predicate holds.
|
void |
await(GammaTxn tx,
boolean value) |
void |
await(GammaTxn tx,
BooleanPredicate predicate) |
void |
await(Txn tx,
boolean value)
Awaits for the reference to become the given value.
|
void |
await(Txn tx,
BooleanPredicate predicate)
Awaits until the predicate holds using the provided txn.
|
void |
commute(BooleanFunction function)
Applies the function on the ref in a commuting manner.
|
void |
commute(GammaTxn tx,
BooleanFunction function) |
void |
commute(Txn tx,
BooleanFunction function)
Applies the function on the ref in a commuting manner.
|
boolean |
get()
Gets the value using the provided txn.
|
boolean |
get(GammaTxn tx) |
boolean |
get(Txn tx)
Gets the value using the provided txn.
|
boolean |
getAndAlter(BooleanFunction function)
Alters the value stored in this Ref using the provided function amd returns the old value.
|
boolean |
getAndAlter(GammaTxn tx,
BooleanFunction function) |
boolean |
getAndAlter(Txn tx,
BooleanFunction function)
Alters the value stored in this Ref using the function and returns the old value, using the provided txn.
|
boolean |
getAndLock(GammaTxn tx,
LockMode lockMode) |
boolean |
getAndLock(LockMode lockMode)
Gets the value and applies the lock.
|
boolean |
getAndLock(Txn tx,
LockMode lockMode)
Gets the value using the provided txn and acquired the lock with the specified LockMode.
|
boolean |
getAndSet(boolean value)
Sets the value the value and returns the new value.
|
boolean |
getAndSet(GammaTxn tx,
boolean value) |
boolean |
getAndSet(Txn tx,
boolean value)
Sets the value using the provided txn.
|
boolean |
getAndSetAndLock(boolean value,
LockMode lockMode)
Sets the value, acquired the Lock with the specified Lockmode and returns the previous value.
|
boolean |
getAndSetAndLock(GammaTxn tx,
boolean value,
LockMode lockMode) |
boolean |
getAndSetAndLock(Txn tx,
boolean value,
LockMode lockMode)
Sets the value and acquired the Lock with the provided LockMode.
|
boolean |
set(boolean value)
Sets the new value.
|
boolean |
set(GammaTxn tx,
boolean value) |
boolean |
set(Txn tx,
boolean value)
Sets the new value using the provided txn.
|
boolean |
setAndLock(boolean value,
LockMode lockMode)
Sets the new value and applies the lock.
|
boolean |
setAndLock(GammaTxn tx,
boolean value,
LockMode lockMode) |
boolean |
setAndLock(Txn tx,
boolean value,
LockMode lockMode)
Sets the new value using the provided txn.
|
String |
toDebugString()
Returns a debug representation of the TxnObject.
|
String |
toString()
Returns a String representation of the Object using the
Txn on the TxnThreadLocal . |
String |
toString(GammaTxn tx) |
String |
toString(Txn tx)
Returns a String representation of the object using the provided
Txn . |
acquire, acquire, acquire, arriveAndExclusiveLockOrBackoff, atomicCompareAndSetLong, atomicGetLong, atomicObjectGet, atomicSetLong, atomicSetObject, commit, ensure, ensure, ensure, flattenCommute, getLong, getObject, hasReadConflict, leanCommit, load, openForCommute, openForCommute, openForCommute, openForCommute, openForConstruction, openForConstruction, openForConstruction, openForConstruction, openForRead, openForRead, openForRead, openForRead, openForRead, openForRead, openForWrite, openForWrite, openForWrite, openForWrite, openForWrite, openForWrite, prepare, registerChangeListener, releaseAfterFailure, releaseAfterReading, releaseAfterUpdate, setLong, setObject, tryLockAndCheckConflict
___removeListenersAfterWrite, ___toOrecString, arrive, arriveAndExclusiveLock, arriveAndLock, atomicGetLockMode, atomicGetLockModeAsInt, departAfterFailure, departAfterFailureAndUnlock, departAfterReading, departAfterReadingAndUnlock, departAfterUpdateAndUnlock, getLock, getLockMode, getLockMode, getLockMode, getReadBiasedThreshold, getReadLockCount, getReadLockCount, getReadonlyCount, getReadonlyCount, getStm, getSurplus, getSurplus, getVersion, hasAnyLock, hasExclusiveLock, hasExclusiveLock, hasWriteLock, hasWriteLock, hasWriteOrExclusiveLock, identityHashCode, isReadBiased, isReadBiased, lockAfterArrive, setExclusiveLock, setIsReadBiased, setReadLockCount, setReadonlyCount, setSurplus, setWriteLock, unlockByUnregistered, upgradeReadLock, upgradeWriteLock, waitForExclusiveLockToBecomeFree
public GammaTxnBoolean(boolean value)
public GammaTxnBoolean(GammaTxn tx)
public GammaTxnBoolean(GammaTxn tx, boolean value)
public GammaTxnBoolean(GammaStm stm)
public GammaTxnBoolean(GammaStm stm, boolean b)
public final boolean get()
TxnBoolean
get
in interface TxnBoolean
TxnBoolean.atomicGet()
public final boolean get(Txn tx)
TxnBoolean
get
in interface TxnBoolean
tx
- the Txn
used for this operation.public final boolean get(GammaTxn tx)
public final boolean getAndLock(LockMode lockMode)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndLock
in interface TxnBoolean
lockMode
- the LockMode applied.TxnBoolean.atomicGet()
public final boolean getAndLock(Txn tx, LockMode lockMode)
TxnBoolean
getAndLock
in interface TxnBoolean
tx
- the Txn
used for this operation.lockMode
- the LockMode usedpublic final boolean set(boolean value)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
set
in interface TxnBoolean
value
- the new value.public final boolean set(Txn tx, boolean value)
TxnBoolean
set
in interface TxnBoolean
tx
- the Txn
used for this operation.value
- the new valuepublic final boolean set(GammaTxn tx, boolean value)
public final boolean setAndLock(boolean value, LockMode lockMode)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
setAndLock
in interface TxnBoolean
value
- the new value.lockMode
- the used LockMode.public final boolean setAndLock(Txn tx, boolean value, LockMode lockMode)
TxnBoolean
setAndLock
in interface TxnBoolean
tx
- the Txn
used for this operation.value
- the new valuelockMode
- the lockMode used.public final boolean getAndSet(boolean value)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndSet
in interface TxnBoolean
value
- the new value.public final boolean getAndSet(Txn tx, boolean value)
TxnBoolean
getAndSet
in interface TxnBoolean
tx
- the Txn
used for this operation.value
- the new value.public final boolean getAndSetAndLock(boolean value, LockMode lockMode)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndSetAndLock
in interface TxnBoolean
value
- the new value.lockMode
- the LockMode used.public final boolean getAndSetAndLock(Txn tx, boolean value, LockMode lockMode)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndSetAndLock
in interface TxnBoolean
tx
- the Txn
used for this operation.value
- the new value.lockMode
- the LockMode used.public final boolean getAndSetAndLock(GammaTxn tx, boolean value, LockMode lockMode)
public final boolean getAndSet(GammaTxn tx, boolean value)
public final boolean atomicGet()
TxnBoolean
TxnBoolean.atomicWeakGet()
.atomicGet
in interface TxnBoolean
public final boolean atomicWeakGet()
TxnBoolean
It is the best method to call if you just want to get the current value stored.
atomicWeakGet
in interface TxnBoolean
public final boolean atomicSet(boolean newValue)
TxnBoolean
atomicSet
in interface TxnBoolean
newValue
- the new value.public final boolean atomicGetAndSet(boolean newValue)
TxnBoolean
atomicGetAndSet
in interface TxnBoolean
newValue
- the new value.public final void commute(BooleanFunction function)
TxnBoolean
This is different than the behavior in Clojure where the commute will be re-applied at the end of the txn, even though some dependency is introduced, which can lead to inconsistencies.
This call lifts on the Txn
stored in the TxnThreadLocal
.
commute
in interface TxnBoolean
function
- the function to apply to this reference.public final void commute(Txn tx, BooleanFunction function)
TxnBoolean
This is different than the behavior in Clojure where the commute will be re-applied at the end of the txn, even though some dependency is introduced, which can lead to inconsistencies.
This call lifts on the Txn
stored in the TxnThreadLocal
.
commute
in interface TxnBoolean
tx
- the Txn
used for this operation.function
- the function to apply to this reference.public final void commute(GammaTxn tx, BooleanFunction function)
public final boolean getAndAlter(BooleanFunction function)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
getAndAlter
in interface TxnBoolean
function
- the function that alters the value stored in this Ref.public final boolean getAndAlter(Txn tx, BooleanFunction function)
TxnBoolean
getAndAlter
in interface TxnBoolean
tx
- the Txn
used for this operation.function
- the function that alters the value stored in this Ref.public final boolean getAndAlter(GammaTxn tx, BooleanFunction function)
public final boolean alterAndGet(BooleanFunction function)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
alterAndGet
in interface TxnBoolean
function
- the function that alters the value stored in this Ref.public final boolean alterAndGet(Txn tx, BooleanFunction function)
TxnBoolean
alterAndGet
in interface TxnBoolean
tx
- the Txn
used for this operation.function
- the function that alters the value stored in this Ref.public final boolean alterAndGet(GammaTxn tx, BooleanFunction function)
public final boolean alter(GammaTxn tx, BooleanFunction function, boolean returnOld)
public final boolean atomicAlterAndGet(BooleanFunction function)
TxnBoolean
atomicAlterAndGet
in interface TxnBoolean
function
- the Function usedpublic final boolean atomicGetAndAlter(BooleanFunction function)
TxnBoolean
atomicGetAndAlter
in interface TxnBoolean
function
- the Function usedpublic final boolean atomicCompareAndSet(boolean expectedValue, boolean newValue)
TxnBoolean
atomicCompareAndSet
in interface TxnBoolean
expectedValue
- the expected value.newValue
- the new value.public final void await(boolean value)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
await
in interface TxnBoolean
value
- the value to wait for.public final void await(Txn tx, boolean value)
TxnBoolean
await
in interface TxnBoolean
tx
- the Txn
used for this operation.value
- the value to wait for.public final void await(GammaTxn tx, boolean value)
public final void await(BooleanPredicate predicate)
TxnBoolean
This call lifts on the Txn
stored in the TxnThreadLocal
.
await
in interface TxnBoolean
predicate
- the predicate to evaluate.public final void await(Txn tx, BooleanPredicate predicate)
TxnBoolean
await
in interface TxnBoolean
tx
- the Txn
used for this operation.predicate
- the predicate to evaluate.public final void await(GammaTxn tx, BooleanPredicate predicate)
public final String toDebugString()
TxnObject
toDebugString
in interface TxnObject
public final String toString()
TxnObject
Txn
on the TxnThreadLocal
.public final String toString(Txn tx)
TxnObject
Txn
.public final String atomicToString()
TxnObject
TxnThreadLocal
. The outputted value doesn't need to be consistent from some point
in time, only a best effort is made.atomicToString
in interface TxnObject
Copyright © 2020. All rights reserved.