mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Fix Experimental API use
This commit is contained in:
parent
9757724436
commit
71f639ae0e
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user