-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Swap atomifcfu for touchlab/Stately due to JVM 21 issues
- Loading branch information
Showing
11 changed files
with
38 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,6 @@ plugins { | |
} | ||
|
||
kotlin { | ||
targets { | ||
|
||
} | ||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
geary-core/src/commonMain/kotlin/com/mineinabyss/geary/datatypes/maps/SynchronizedTypeMap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
package com.mineinabyss.geary.datatypes.maps | ||
|
||
import co.touchlab.stately.concurrency.Synchronizable | ||
import co.touchlab.stately.concurrency.synchronize | ||
import com.mineinabyss.geary.datatypes.Entity | ||
import com.mineinabyss.geary.engine.archetypes.Archetype | ||
import kotlinx.atomicfu.locks.SynchronizedObject | ||
import kotlinx.atomicfu.locks.synchronized | ||
|
||
class SynchronizedArrayTypeMap : ArrayTypeMap() { | ||
private val lock = SynchronizedObject() | ||
private val lock = Synchronizable() | ||
|
||
override fun getArchAndRow(entity: Entity): ULong { | ||
return synchronized(lock) { super.getArchAndRow(entity) } | ||
return lock.synchronize { super.getArchAndRow(entity) } | ||
} | ||
|
||
override fun set(entity: Entity, archetype: Archetype, row: Int) { | ||
synchronized(lock) { super.set(entity, archetype, row) } | ||
lock.synchronize { super.set(entity, archetype, row) } | ||
} | ||
|
||
override fun remove(entity: Entity) = synchronized(lock) { super.remove(entity) } | ||
override fun contains(entity: Entity): Boolean = synchronized(lock) { super.contains(entity) } | ||
override fun remove(entity: Entity) = lock.synchronize { super.remove(entity) } | ||
override fun contains(entity: Entity): Boolean = lock.synchronize { super.contains(entity) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters