Fix Experimental API use

This commit is contained in:
Him188 2019-12-13 09:57:42 +08:00
parent 9757724436
commit 71f639ae0e

View File

@ -10,6 +10,7 @@ import org.junit.Test
import kotlin.system.exitProcess import kotlin.system.exitProcess
import kotlin.test.* import kotlin.test.*
@MiraiExperimentalAPI
internal class LockFreeLinkedListTest { internal class LockFreeLinkedListTest {
init { init {
GlobalScope.launch { GlobalScope.launch {
@ -226,9 +227,11 @@ internal class LockFreeLinkedListTest {
internal fun withTimeoutBlocking(timeout: Long = 500L, block: suspend () -> Unit) = runBlocking { withTimeout(timeout) { block() } } internal fun withTimeoutBlocking(timeout: Long = 500L, block: suspend () -> Unit) = runBlocking { withTimeout(timeout) { block() } }
@MiraiExperimentalAPI
internal suspend fun <E> LockFreeLinkedList<E>.concurrentAdd(numberOfCoroutines: Int, timesOfAdd: Int, element: E) = internal suspend fun <E> LockFreeLinkedList<E>.concurrentAdd(numberOfCoroutines: Int, timesOfAdd: Int, element: E) =
concurrentDo(numberOfCoroutines, timesOfAdd) { add(element) } concurrentDo(numberOfCoroutines, timesOfAdd) { add(element) }
@MiraiExperimentalAPI
internal suspend fun <E : LockFreeLinkedList<*>> E.concurrentDo(numberOfCoroutines: Int, timesOfAdd: Int, todo: E.() -> Unit) = coroutineScope { internal suspend fun <E : LockFreeLinkedList<*>> E.concurrentDo(numberOfCoroutines: Int, timesOfAdd: Int, todo: E.() -> Unit) = coroutineScope {
repeat(numberOfCoroutines) { repeat(numberOfCoroutines) {
launch { launch {