File tree 3 files changed +15
-0
lines changed
3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1583,6 +1583,7 @@ internal open class BufferedChannel<E>(
1583
1583
* continuation. The [tryResumeHasNext] and [tryResumeHasNextOnClosedChannel]
1584
1584
* function resume this continuation when the [hasNext] invocation should complete.
1585
1585
*/
1586
+ @BenignDataRace // See its uses for the explanation of the race
1586
1587
private var continuation: CancellableContinuationImpl <Boolean >? = null
1587
1588
1588
1589
// `hasNext()` is just a special receive operation.
Original file line number Diff line number Diff line change @@ -12,3 +12,15 @@ internal expect class ReentrantLock() {
12
12
internal expect inline fun <T > ReentrantLock.withLock (action : () -> T ): T
13
13
14
14
internal expect fun <E > identitySet (expectedSize : Int ): MutableSet <E >
15
+
16
+ /* *
17
+ * Annotation indicating that the marked property is the subject of benign data race.
18
+ * LLVM does not support this notion, so on K/N platforms we alias it into `@Volatile` to prevent potential OoTA.
19
+ *
20
+ * The purpose of this annotation is not to save an extra-volatile on JVM platform, but rather to explicitly emphasize
21
+ * that data-race is benign.
22
+ */
23
+ @OptionalExpectation
24
+ @Target(AnnotationTarget .FIELD )
25
+ @OptIn(ExperimentalMultiplatform ::class )
26
+ internal expect annotation class BenignDataRace ()
Original file line number Diff line number Diff line change @@ -29,3 +29,5 @@ internal open class SuppressSupportingThrowableImpl : Throwable() {
29
29
}
30
30
}
31
31
32
+ @Suppress(" ACTUAL_WITHOUT_EXPECT" ) // This suppress can be removed in 2.0: KT-59355
33
+ internal actual typealias BenignDataRace = kotlin.concurrent.Volatile
You can’t perform that action at this time.
0 commit comments