Skip to content

Commit

Permalink
copying collection
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSrSouza committed Nov 5, 2023
1 parent 072a06b commit d5e559c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cafe.adriel.voyager.core.concurrent

import androidx.compose.runtime.toMutableStateList
import kotlinx.atomicfu.locks.SynchronizedObject
import kotlinx.atomicfu.locks.synchronized

Expand Down Expand Up @@ -29,11 +30,11 @@ public actual class ThreadSafeMap<K, V>(
}

override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
get() = synchronized(syncObject) { delegate.entries }
get() = synchronized(syncObject) { delegate.entries.toMutableSet() }
override val keys: MutableSet<K>
get() = synchronized(syncObject) { delegate.keys }
get() = synchronized(syncObject) { delegate.keys.toMutableSet() }
override val values: MutableCollection<V>
get() = synchronized(syncObject) { delegate.values }
get() = synchronized(syncObject) { delegate.values.toMutableList() }

override fun clear() {
synchronized(syncObject) { delegate.clear() }
Expand Down

0 comments on commit d5e559c

Please sign in to comment.