[history] Added .toString() for debugging
This commit is contained in:
parent
f37d81cd60
commit
28b3224e42
@ -51,6 +51,14 @@ internal class CloseableReferenceCounter(private val _errMessage: String) {
|
|||||||
return safeAutoClose1(finally = this::decref, action = protected)
|
return safeAutoClose1(finally = this::decref, action = protected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
val refcntCached = this._value.value
|
||||||
|
if (refcntCached < 0)
|
||||||
|
return "<ref counter [closed]>"
|
||||||
|
else
|
||||||
|
return "<ref counter [${refcntCached}]>"
|
||||||
|
}
|
||||||
|
|
||||||
private fun AtomicLong.compareAndExchange(expected: Long, newValue: Long): Long {
|
private fun AtomicLong.compareAndExchange(expected: Long, newValue: Long): Long {
|
||||||
while (true) {
|
while (true) {
|
||||||
val old = this@compareAndExchange.value
|
val old = this@compareAndExchange.value
|
||||||
|
Loading…
Reference in New Issue
Block a user