isClosed property
This commit is contained in:
parent
6581c14072
commit
e3d0aabd0f
@ -53,6 +53,8 @@ public class CloseableReferenceCounter {
|
|||||||
return safeAutoClose2(onSuccess = this::decref, action = block)
|
return safeAutoClose2(onSuccess = this::decref, action = block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public val isClosed: Boolean get() = this._value.get() < 0
|
||||||
|
|
||||||
public fun close(errExistRefs: String) {
|
public fun close(errExistRefs: String) {
|
||||||
_Platform.jvm_assertNotNull(errExistRefs, "param: errExistRefs")
|
_Platform.jvm_assertNotNull(errExistRefs, "param: errExistRefs")
|
||||||
val state = _CloseableReferenceCounter_LowLevel.compareAndExchange(this._value, 0, _CloseableReferenceCounter_LowLevel.CLOSED_STATE_VALUE)
|
val state = _CloseableReferenceCounter_LowLevel.compareAndExchange(this._value, 0, _CloseableReferenceCounter_LowLevel.CLOSED_STATE_VALUE)
|
||||||
|
@ -37,7 +37,6 @@ public class CloseableReferenceCounter_Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
private inline fun _throwErrors(valueToCheck: Long) {
|
private inline fun _throwErrors(valueToCheck: Long) {
|
||||||
when {
|
when {
|
||||||
@ -100,6 +99,13 @@ public class CloseableReferenceCounter_Debug {
|
|||||||
return safeAutoClose2(onSuccess = this::decref, action = block)
|
return safeAutoClose2(onSuccess = this::decref, action = block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public val isClosed: Boolean
|
||||||
|
get() {
|
||||||
|
val state = this._value.get()
|
||||||
|
this._throwErrors(state)
|
||||||
|
return state < 0;
|
||||||
|
}
|
||||||
|
|
||||||
public fun close(errExistRefs: String) {
|
public fun close(errExistRefs: String) {
|
||||||
_Platform.jvm_assertNotNull(errExistRefs, "param: errExistRefs")
|
_Platform.jvm_assertNotNull(errExistRefs, "param: errExistRefs")
|
||||||
val state = _CloseableReferenceCounter_LowLevel.compareAndExchange(this._value, 0, _CloseableReferenceCounter_LowLevel.CLOSED_STATE_VALUE)
|
val state = _CloseableReferenceCounter_LowLevel.compareAndExchange(this._value, 0, _CloseableReferenceCounter_LowLevel.CLOSED_STATE_VALUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user