Commit 1e0ed74 1 parent 7015ad2 commit 1e0ed74 Copy full SHA for 1e0ed74
File tree 1 file changed +7
-1
lines changed
kotlinx-coroutines-core/src/test/kotlin/guide/test
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,17 @@ fun threadNames(): Set<String> {
43
43
}
44
44
val names = hashSetOf<String >()
45
45
for (i in 0 until n)
46
- names.add(arrayOfThreads[i]!! .name)
46
+ names.add(sanitizeThreadName( arrayOfThreads[i]!! .name) )
47
47
return names
48
48
}
49
49
}
50
50
51
+ // remove coroutine names from thread in case we have lost threads with coroutines running in them
52
+ private fun sanitizeThreadName (name : String ): String {
53
+ val i = name.indexOf(" @" )
54
+ return if (i < 0 ) name else name.substring(0 , i)
55
+ }
56
+
51
57
fun checkTestThreads (threadNamesBefore : Set <String >) {
52
58
// give threads some time to shutdown
53
59
val waitTill = System .currentTimeMillis() + 1000L
You can’t perform that action at this time.
0 commit comments