Skip to content

Commit 60f8688

Browse files
committed
Use common SharedImmutable declaration from stdlib
1 parent 476d6de commit 60f8688

15 files changed

+22
-10
lines changed

kotlinx-coroutines-core/common/src/CancellableContinuationImpl.kt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import kotlinx.coroutines.internal.*
99
import kotlin.coroutines.*
1010
import kotlin.coroutines.intrinsics.*
1111
import kotlin.jvm.*
12+
import kotlin.native.concurrent.*
1213

1314
private const val UNDECIDED = 0
1415
private const val SUSPENDED = 1

kotlinx-coroutines-core/common/src/EventLoop.common.kt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import kotlinx.atomicfu.*
88
import kotlinx.coroutines.internal.*
99
import kotlin.coroutines.*
1010
import kotlin.jvm.*
11+
import kotlin.native.concurrent.*
1112

1213
/**
1314
* Extended by [CoroutineDispatcher] implementations that have event loop inside and can

kotlinx-coroutines-core/common/src/JobSupport.kt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import kotlin.coroutines.*
1313
import kotlin.coroutines.intrinsics.*
1414
import kotlin.js.*
1515
import kotlin.jvm.*
16+
import kotlin.native.concurrent.*
1617

1718
/**
1819
* A concrete implementation of [Job]. It is optionally a child to a parent job.

kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import kotlinx.coroutines.intrinsics.*
1111
import kotlinx.coroutines.selects.*
1212
import kotlin.coroutines.*
1313
import kotlin.jvm.*
14+
import kotlin.native.concurrent.*
1415

1516
/**
1617
* Abstract send channel. It is a base class for all send channel implementations.

kotlinx-coroutines-core/common/src/channels/ConflatedBroadcastChannel.kt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import kotlinx.coroutines.internal.*
1010
import kotlinx.coroutines.intrinsics.*
1111
import kotlinx.coroutines.selects.*
1212
import kotlin.jvm.*
13+
import kotlin.native.concurrent.*
1314

1415
/**
1516
* Broadcasts the most recently sent element (aka [value]) to all [openSubscription] subscribers.

kotlinx-coroutines-core/common/src/flow/internal/NullSurrogate.kt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package kotlinx.coroutines.flow.internal
66

77
import kotlinx.coroutines.internal.*
88
import kotlin.jvm.*
9+
import kotlin.native.concurrent.*
910

1011
/**
1112
* This value is used a a surrogate `null` value when needed.

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

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package kotlinx.coroutines.internal
77
import kotlinx.atomicfu.atomic
88
import kotlinx.coroutines.*
99
import kotlin.jvm.*
10+
import kotlin.native.concurrent.*
1011

1112
/**
1213
* The most abstract operation that can be in process. Other threads observing an instance of this

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.coroutines.internal
@@ -22,7 +22,3 @@ internal expect class ReentrantLock() {
2222
internal expect inline fun <T> ReentrantLock.withLock(action: () -> T): T
2323

2424
internal expect fun <E> identitySet(expectedSize: Int): MutableSet<E>
25-
26-
@ExperimentalMultiplatform
27-
@OptionalExpectation
28-
internal expect annotation class SharedImmutable()

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

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import kotlinx.atomicfu.*
88
import kotlinx.coroutines.internal.*
99
import kotlin.coroutines.*
1010
import kotlin.jvm.*
11+
import kotlin.native.concurrent.*
1112

1213
@SharedImmutable
1314
private val UNDEFINED = Symbol("UNDEFINED")

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

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package kotlinx.coroutines.internal
66

77
import kotlin.jvm.*
8+
import kotlin.native.concurrent.*
89

910
/** @suppress **This is unstable API and it is subject to change.** */
1011
public expect open class LockFreeLinkedListNode() {

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

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import kotlinx.coroutines.sync.*
1313
import kotlin.coroutines.*
1414
import kotlin.coroutines.intrinsics.*
1515
import kotlin.jvm.*
16+
import kotlin.native.concurrent.*
1617

1718
/**
1819
* Scope for [select] invocation.
@@ -213,6 +214,7 @@ internal class SeqNumber {
213214
fun next() = number.incrementAndGet()
214215
}
215216

217+
@SharedImmutable
216218
private val selectOpSequenceNumber = SeqNumber()
217219

218220
@PublishedApi

kotlinx-coroutines-core/common/src/sync/Mutex.kt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import kotlinx.coroutines.intrinsics.*
1111
import kotlinx.coroutines.selects.*
1212
import kotlin.coroutines.*
1313
import kotlin.jvm.*
14+
import kotlin.native.concurrent.*
1415

1516
/**
1617
* Mutual exclusion for coroutines.

kotlinx-coroutines-core/common/src/sync/Semaphore.kt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
15
package kotlinx.coroutines.sync
26

37
import kotlinx.atomicfu.*
@@ -6,6 +10,7 @@ import kotlinx.coroutines.internal.*
610
import kotlin.coroutines.*
711
import kotlin.jvm.*
812
import kotlin.math.*
13+
import kotlin.native.concurrent.*
914

1015
/**
1116
* A counting semaphore for coroutines that logically maintains a number of available permits.

kotlinx-coroutines-core/native/src/CoroutineContext.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.coroutines
66

77
import kotlin.coroutines.*
8+
import kotlin.native.concurrent.*
89

910
private fun takeEventLoop(): EventLoopImpl =
1011
ThreadLocalEventLoop.currentOrNull() as? EventLoopImpl ?:
@@ -26,6 +27,7 @@ internal fun loopWasShutDown(): Nothing = error("Cannot execute task because eve
2627
internal actual fun createDefaultDispatcher(): CoroutineDispatcher =
2728
DefaultExecutor
2829

30+
@SharedImmutable
2931
internal actual val DefaultDelay: Delay = DefaultExecutor
3032

3133
public actual fun CoroutineScope.newCoroutineContext(context: CoroutineContext): CoroutineContext {

kotlinx-coroutines-core/native/src/internal/Concurrent.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package kotlinx.coroutines.internal
@@ -16,6 +16,3 @@ internal class NoOpLock {
1616
internal actual fun <E> subscriberList(): MutableList<E> = CopyOnWriteList<E>()
1717

1818
internal actual fun <E> identitySet(expectedSize: Int): MutableSet<E> = HashSet()
19-
20-
@Suppress("ACTUAL_WITHOUT_EXPECT")
21-
internal actual typealias SharedImmutable = kotlin.native.concurrent.SharedImmutable

0 commit comments

Comments
 (0)