File tree Expand file tree Collapse file tree 5 files changed +7
-13
lines changed
compose/runtime/runtime/src
jvmTest/kotlin/androidx/compose/runtime/internal
nativeTest/kotlin/androidx/compose/runtime/internal
nonEmulatorCommonTest/kotlin/androidx/compose/runtime
webTest/kotlin/androidx/compose/runtime/internal Expand file tree Collapse file tree 5 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 1616
1717package androidx.compose.runtime.internal
1818
19- actual fun isSleepAvailable () = true
20-
21- actual fun sleep (millis : UInt ) =
19+ internal actual fun sleep (millis : UInt ) =
2220 Thread .sleep(millis.toLong())
Original file line number Diff line number Diff line change 1616
1717package androidx.compose.runtime.internal
1818
19- actual fun isSleepAvailable () = true
20-
21- actual fun sleep (millis : UInt ) {
19+ internal actual fun sleep (millis : UInt ) {
2220 platform.posix.usleep(millis)
2321}
Original file line number Diff line number Diff line change 1717package androidx.compose.runtime
1818
1919import androidx.compose.runtime.internal.AtomicInt
20- import androidx.compose.runtime.internal.isSleepAvailable
2120import androidx.compose.runtime.internal.sleep
2221import kotlin.test.Test
2322import kotlin.test.assertEquals
@@ -36,6 +35,8 @@ import kotlinx.coroutines.launch
3635import kotlinx.coroutines.test.UnconfinedTestDispatcher
3736import kotlinx.coroutines.test.runTest
3837import kotlinx.coroutines.yield
38+ import kotlinx.test.IgnoreJsTarget
39+ import kotlinx.test.IgnoreWasmTarget
3940
4041@ExperimentalCoroutinesApi
4142class BroadcastFrameClockTest {
@@ -87,9 +88,10 @@ class BroadcastFrameClockTest {
8788 }
8889
8990 @OptIn(InternalCoroutinesApi ::class )
91+ @IgnoreJsTarget
92+ @IgnoreWasmTarget
9093 @Test
9194 fun locklessCancellation () = runTest(timeout = 5_000 .milliseconds) {
92- if (! isSleepAvailable()) return @runTest
9395
9496 val clock = BroadcastFrameClock ()
9597 val cancellationGate = AtomicInt (1 )
Original file line number Diff line number Diff line change 1616
1717package androidx.compose.runtime.internal
1818
19- internal expect fun isSleepAvailable (): Boolean
20-
2119internal expect fun sleep (millis : UInt )
Original file line number Diff line number Diff line change 1616
1717package androidx.compose.runtime.internal
1818
19- actual fun isSleepAvailable () = false
20-
21- actual fun sleep (millis : UInt ): Unit =
19+ internal actual fun sleep (millis : UInt ): Unit =
2220 throw UnsupportedOperationException (" Sleep is not supported" )
You can’t perform that action at this time.
0 commit comments