https://kotlinlang.org logo
#codereview
Title
# codereview
n

napperley

07/31/2022, 11:36 PM
Is there a Kotlinic (idiomatic Kotlin) way for multiple Coroutines to access/manipulate data? Below is some code relating to data access/manipulation:
Copy code
private val runningFunctions: FuncList = mutableListOf()
typealias FuncList = MutableList<Pair<UInt, String>>

internal fun addRunningFunction(pid: UInt, funcName: String) {
    runningFunctions += pid to funcName
}

internal fun removeRunningFunction(pid: UInt) {
    val list = runningFunctions.filter { it.first == pid }
    if (list.size == 1) runningFunctions -= list.first()
}

internal fun listRunningFunctions() = runningFunctions.toList()
// ...
Would the code above be scalable with multiple Coroutines running at the same time?