File tree 3 files changed +6
-5
lines changed
kotlinx-coroutines-test/common/src
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public expect class TestResult
55
55
* immediately return the produced [TestResult] from the test method, without doing anything else afterwards. See
56
56
* [TestResult] for details on this.
57
57
*
58
- * The test is run in a single thread, unless other [ContinuationInterceptor ] are used for child coroutines.
58
+ * The test is run in a single thread, unless other [CoroutineDispatcher ] are used for child coroutines.
59
59
* Because of this, child coroutines are not executed in parallel to the test body.
60
60
* In order to for the spawned-off asynchronous code to actually be executed, one must either [yield] or suspend the
61
61
* test body some other way, or use commands that control scheduling (see [TestCoroutineScheduler]).
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ private class UnconfinedTestDispatcherImpl(
137
137
*
138
138
* @see UnconfinedTestDispatcher for a dispatcher that is not confined to any particular thread.
139
139
*/
140
+ @ExperimentalCoroutinesApi
140
141
@Suppress(" FunctionName" )
141
142
public fun StandardTestDispatcher (
142
143
scheduler : TestCoroutineScheduler ? = null,
@@ -155,4 +156,4 @@ private class StandardTestDispatcherImpl(
155
156
}
156
157
157
158
override fun toString (): String = " ${name ? : " StandardTestDispatcher" } [scheduler=$scheduler ]"
158
- }
159
+ }
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ internal class TestMainDispatcher(delegate: CoroutineDispatcher):
60
60
* The read operations never throw. Instead, the failures detected inside them will be remembered and thrown on the
61
61
* next modification.
62
62
*/
63
- private class NonConcurrentlyModifiable <T >(private val initialValue : T , private val name : String ) {
63
+ private class NonConcurrentlyModifiable <T >(initialValue : T , private val name : String ) {
64
64
private val readers = atomic(0 ) // number of concurrent readers
65
65
private val isWriting = atomic(false ) // a modification is happening currently
66
66
private val exceptionWhenReading: AtomicRef <Throwable ?> = atomic(null ) // exception from reading
@@ -77,7 +77,7 @@ internal class TestMainDispatcher(delegate: CoroutineDispatcher):
77
77
readers.decrementAndGet()
78
78
return result
79
79
}
80
- set(value: T ) {
80
+ set(value) {
81
81
exceptionWhenReading.getAndSet(null )?.let { throw it }
82
82
if (readers.value != 0 ) throw concurrentRW()
83
83
if (! isWriting.compareAndSet(expect = false , update = true )) throw concurrentWW()
@@ -93,4 +93,4 @@ private val defaultDelay
93
93
inline get() = DefaultDelay
94
94
95
95
@Suppress(" INVISIBLE_MEMBER" )
96
- internal expect fun Dispatchers.getTestMainDispatcher (): TestMainDispatcher
96
+ internal expect fun Dispatchers.getTestMainDispatcher (): TestMainDispatcher
You can’t perform that action at this time.
0 commit comments