From 71f639ae0ed79c0e90afb3184d50555b3a874c41 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 13 Dec 2019 09:57:42 +0800 Subject: [PATCH] Fix `Experimental API use` --- .../kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt | 3 +++ 1 file changed, 3 insertions(+) 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 {