Skip to content

Commit b7d142d

Browse files
committed
~ Review feedback
1 parent a294089 commit b7d142d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-core.txt

-4
Original file line numberDiff line numberDiff line change
@@ -1080,10 +1080,6 @@ public final class kotlinx/coroutines/selects/SelectKt {
10801080
public static final fun select (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
10811081
}
10821082

1083-
public synthetic class kotlinx/coroutines/selects/SelectKtSelectOpSequenceNumberRefVolatile {
1084-
public fun <init> (J)V
1085-
}
1086-
10871083
public final class kotlinx/coroutines/selects/SelectUnbiasedKt {
10881084
public static final fun selectUnbiased (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
10891085
}

kotlinx-coroutines-core/common/src/internal/Atomic.kt

-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ public abstract class AtomicDesc {
103103
lateinit var atomicOp: AtomicOp<*> // the reference to parent atomicOp, init when AtomicOp is created
104104
abstract fun prepare(op: AtomicOp<*>): Any? // returns `null` if prepared successfully
105105
abstract fun complete(op: AtomicOp<*>, failure: Any?) // decision == null if success
106-
107-
override fun toString(): String = "$classSimpleName@$hexAddress(atomicOp=$atomicOp)" // for debug
108106
}
109107

110108
/**

kotlinx-coroutines-core/common/src/selects/Select.kt

+9-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,14 @@ private val UNDECIDED: Any = Symbol("UNDECIDED")
205205
private val RESUMED: Any = Symbol("RESUMED")
206206

207207
// Global counter of all atomic select operations for their deadlock resolution
208-
private val selectOpSequenceNumber = atomic(1L)
208+
// The separate internal class is work-around for Atomicfu's current implementation that creates public classes
209+
// for static atomics
210+
internal class SeqNumber {
211+
private val number = atomic(1L)
212+
fun next() = number.incrementAndGet()
213+
}
214+
215+
private val selectOpSequenceNumber = SeqNumber()
209216

210217
@PublishedApi
211218
internal class SelectBuilderImpl<in R>(
@@ -541,7 +548,7 @@ internal class SelectBuilderImpl<in R>(
541548
@JvmField val desc: AtomicDesc
542549
) : AtomicOp<Any?>() {
543550
// all select operations are totally ordered by their creating time using selectOpSequenceNumber
544-
override val opSequence = selectOpSequenceNumber.getAndIncrement()
551+
override val opSequence = selectOpSequenceNumber.next()
545552

546553
init {
547554
desc.atomicOp = this

0 commit comments

Comments
 (0)