Hi! Are there any libraries that provide thread-sa...
# multiplatform
c
Hi! Are there any libraries that provide thread-safe collections with multiplatform support?
f
You can do it yourself with:
Copy code
val mutex = Mutex()
val list = mutableListOf<String>()

suspend fun addThreadSafe(item: String) {
    mutex.withLock {
        list.add(item)
    }
}
gratitude thank you 1
👍 1