Skip to content

Commit cf8403c

Browse files
committed
Better track real-time va virtual-time in CPU-consuming tests
1 parent bd6d6dc commit cf8403c

File tree

1 file changed

+2
-1
lines changed
  • kotlinx-coroutines-core/src/test/kotlin/guide/test

1 file changed

+2
-1
lines changed

kotlinx-coroutines-core/src/test/kotlin/guide/test/TestUtil.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ private class ThreadStatus {
152152

153153
private val MAX_WAIT_NANOS = 10_000_000_000L // 10s
154154
private val REAL_TIME_STEP_NANOS = 200_000_000L // 200 ms
155+
private val REAL_PARK_NANOS = 10_000_000L // 10 ms -- park for a little to better track real-time
155156

156157
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
157158
private class TestTimeSource(
@@ -210,7 +211,7 @@ private class TestTimeSource(
210211
status.permit = false
211212
break
212213
}
213-
LockSupport.parkNanos(blocker, REAL_TIME_STEP_NANOS)
214+
LockSupport.parkNanos(blocker, REAL_PARK_NANOS)
214215
}
215216
}
216217

0 commit comments

Comments
 (0)