File tree Expand file tree Collapse file tree 8 files changed +28
-13
lines changed
linuxX64Main/kotlin/co/touchlab/sqliter/concurrency
mingwX64Main/kotlin/co/touchlab/sqliter/concurrency
mingwX86Main/kotlin/co/touchlab/sqliter/concurrency
nativeCommonMain/kotlin/co/touchlab/sqliter Expand file tree Collapse file tree 8 files changed +28
-13
lines changed Original file line number Diff line number Diff line change 11kotlin.code.style =official
22
33GROUP =co.touchlab
4- VERSION_NAME =1.0.10
5- KOTLIN_VERSION =1.5.30
4+ VERSION_NAME =1.0.11
5+ KOTLIN_VERSION =1.6.10
66
77kotlin.native.ignoreDisabledTargets =true
88
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ if(!HostManager.hostIsLinux) {
115115 tasks.findByName(" publishLinuxX64PublicationToMavenRepository" )?.enabled = false
116116}
117117
118+ if (! HostManager .hostIsMingw) {
119+ tasks.findByName(" mingwX64Test" )?.enabled = false
120+ tasks.findByName(" linkDebugTestMingwX64" )?.enabled = false
121+ tasks.findByName(" publishMingwX64PublicationToMavenRepository" )?.enabled = false
122+ }
123+
118124apply (from = " ../gradle/gradle-mvn-mpp-push.gradle" )
119125
120126tasks.register(" publishMac" ){
Original file line number Diff line number Diff line change 11package co.touchlab.sqliter.concurrency
22
3+ import co.touchlab.sqliter.util.maybeFreeze
34import kotlinx.cinterop.Arena
45import kotlinx.cinterop.alloc
56import kotlinx.cinterop.ptr
67import platform.posix.*
7- import kotlin.native.concurrent.freeze
88
99/* *
1010 * A simple lock.
@@ -19,7 +19,7 @@ actual class Lock actual constructor() {
1919 pthread_mutexattr_init(attr.ptr)
2020 pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE .toInt())
2121 pthread_mutex_init(mutex.ptr, attr.ptr)
22- freeze ()
22+ maybeFreeze ()
2323 }
2424
2525 actual fun lock () {
Original file line number Diff line number Diff line change 11package co.touchlab.sqliter.concurrency
22
3+ import co.touchlab.sqliter.util.maybeFreeze
34import kotlinx.cinterop.Arena
45import kotlinx.cinterop.alloc
56import kotlinx.cinterop.ptr
@@ -14,7 +15,6 @@ import platform.posix.pthread_mutexattr_destroy
1415import platform.posix.pthread_mutexattr_init
1516import platform.posix.pthread_mutexattr_settype
1617import platform.posix.pthread_mutexattr_tVar
17- import kotlin.native.concurrent.freeze
1818
1919/* *
2020 * A simple lock.
@@ -29,7 +29,7 @@ actual class Lock actual constructor() {
2929 pthread_mutexattr_init(attr.ptr)
3030 pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE .toInt())
3131 pthread_mutex_init(mutex.ptr, attr.ptr)
32- freeze ()
32+ maybeFreeze ()
3333 }
3434
3535 actual fun lock () {
Original file line number Diff line number Diff line change 11package co.touchlab.sqliter.concurrency
22
3+ import co.touchlab.sqliter.util.maybeFreeze
34import kotlinx.cinterop.Arena
45import kotlinx.cinterop.alloc
56import kotlinx.cinterop.ptr
@@ -14,7 +15,6 @@ import platform.posix.pthread_mutexattr_destroy
1415import platform.posix.pthread_mutexattr_init
1516import platform.posix.pthread_mutexattr_settype
1617import platform.posix.pthread_mutexattr_tVar
17- import kotlin.native.concurrent.freeze
1818
1919/* *
2020 * A simple lock.
@@ -29,7 +29,7 @@ actual class Lock actual constructor() {
2929 pthread_mutexattr_init(attr.ptr)
3030 pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE .toInt())
3131 pthread_mutex_init(mutex.ptr, attr.ptr)
32- freeze ()
32+ maybeFreeze ()
3333 }
3434
3535 actual fun lock () {
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ import co.touchlab.sqliter.*
2020import co.touchlab.sqliter.concurrency.Lock
2121import co.touchlab.sqliter.concurrency.withLock
2222import co.touchlab.sqliter.interop.SqliteDatabase
23+ import co.touchlab.sqliter.util.maybeFreeze
2324import kotlin.native.concurrent.AtomicInt
2425import kotlin.native.concurrent.AtomicReference
25- import kotlin.native.concurrent.freeze
2626
2727class NativeDatabaseConnection (
2828 val dbManager : NativeDatabaseManager ,
@@ -45,12 +45,12 @@ class NativeDatabaseConnection(
4545
4646 override fun beginTransaction () = transLock.withLock {
4747 withStatement(" BEGIN;" ) { execute() }
48- transaction.value = Transaction (false ).freeze ()
48+ transaction.value = Transaction (false ).maybeFreeze ()
4949 }
5050
5151 override fun setTransactionSuccessful () = transLock.withLock {
5252 val trans = checkFailTransaction()
53- transaction.value = trans.copy(successful = true ).freeze ()
53+ transaction.value = trans.copy(successful = true ).maybeFreeze ()
5454 }
5555
5656 override fun endTransaction () = transLock.withLock {
Original file line number Diff line number Diff line change @@ -23,14 +23,14 @@ import co.touchlab.sqliter.concurrency.SingleThreadDatabaseConnection
2323import co.touchlab.sqliter.concurrency.withLock
2424import co.touchlab.sqliter.interop.OpenFlags
2525import co.touchlab.sqliter.interop.dbOpen
26+ import co.touchlab.sqliter.util.maybeFreeze
2627import kotlin.native.concurrent.AtomicInt
27- import kotlin.native.concurrent.freeze
2828
2929class NativeDatabaseManager (private val path : String ,
3030 override val configuration : DatabaseConfiguration
3131): DatabaseManager {
3232 override fun createMultiThreadedConnection (): DatabaseConnection {
33- return ConcurrentDatabaseConnection (createConnection()).freeze ()
33+ return ConcurrentDatabaseConnection (createConnection()).maybeFreeze ()
3434 }
3535
3636 override fun createSingleThreadedConnection (): DatabaseConnection {
Original file line number Diff line number Diff line change 1+ package co.touchlab.sqliter.util
2+
3+ import kotlin.native.concurrent.freeze
4+
5+ internal inline fun <T > T.maybeFreeze (): T = if (Platform .memoryModel == MemoryModel .STRICT ) {
6+ this .freeze()
7+ } else {
8+ this
9+ }
You can’t perform that action at this time.
0 commit comments