You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/internal/LockFreeLinkedListAtomicStressLFTest.kt
+4-15Lines changed: 4 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -56,23 +56,22 @@ class LockFreeLinkedListAtomicStressLFTest : TestBase() {
56
56
val list = lists[rnd.nextInt(nLists)]
57
57
val node =IntNode(threadId)
58
58
list.addLast(node)
59
-
burnTime(rnd)
59
+
randomSpinWaitIntermission()
60
60
tryRemove(node)
61
61
}
62
62
1-> {
63
63
// just to test conditional add
64
64
val list = lists[rnd.nextInt(nLists)]
65
65
val node =IntNode(threadId)
66
66
assertTrue(list.addLastIf(node, { true }))
67
-
burnTime(rnd)
67
+
randomSpinWaitIntermission()
68
68
tryRemove(node)
69
69
}
70
70
2-> {
71
71
// just to test failed conditional add and burn some time
72
72
val list = lists[rnd.nextInt(nLists)]
73
73
val node =IntNode(threadId)
74
74
assertFalse(list.addLastIf(node, { false }))
75
-
burnTime(rnd)
76
75
}
77
76
3-> {
78
77
// add two atomically
@@ -95,8 +94,9 @@ class LockFreeLinkedListAtomicStressLFTest : TestBase() {
95
94
}
96
95
}
97
96
assertTrue(op.perform(null) ==null)
98
-
burnTime(rnd)
97
+
randomSpinWaitIntermission()
99
98
tryRemove(node1)
99
+
randomSpinWaitIntermission()
100
100
tryRemove(node2)
101
101
}
102
102
else-> error("Cannot happen")
@@ -141,17 +141,6 @@ class LockFreeLinkedListAtomicStressLFTest : TestBase() {
141
141
lists.forEach { it.validate() }
142
142
}
143
143
144
-
privateval sink =IntArray(1024)
145
-
146
-
privatefunburnTime(rnd:Random) {
147
-
if (rnd.nextInt(100) <95) return// be quick, no wait 95% of time
0 commit comments