diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt b/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt index b81c18938..1e3e8ed0d 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt +++ b/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt @@ -10,6 +10,7 @@ import org.junit.Test import kotlin.system.exitProcess import kotlin.test.* +@MiraiExperimentalAPI internal class LockFreeLinkedListTest { init { GlobalScope.launch { @@ -226,9 +227,11 @@ internal class LockFreeLinkedListTest { internal fun withTimeoutBlocking(timeout: Long = 500L, block: suspend () -> Unit) = runBlocking { withTimeout(timeout) { block() } } +@MiraiExperimentalAPI internal suspend fun LockFreeLinkedList.concurrentAdd(numberOfCoroutines: Int, timesOfAdd: Int, element: E) = concurrentDo(numberOfCoroutines, timesOfAdd) { add(element) } +@MiraiExperimentalAPI internal suspend fun > E.concurrentDo(numberOfCoroutines: Int, timesOfAdd: Int, todo: E.() -> Unit) = coroutineScope { repeat(numberOfCoroutines) { launch {