Skip to content

Commit

Permalink
Bump kotlin to v1.7.20 (#295)
Browse files Browse the repository at this point in the history
* Bump kotlin to v1.7.20

* Remove deprecated legacy native memory model functions

* Fix build error

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Erik Christensen <[email protected]>
  • Loading branch information
renovate[bot] and erikc5000 authored Oct 4, 2022
1 parent 0b65d07 commit d2a725e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import platform.Foundation.NSCalendar
import platform.Foundation.NSCalendarIdentifierISO8601
import kotlin.native.concurrent.Worker

@SharedImmutable
private val worker = Worker.start(errorReporting = false)

actual object PlatformDateTimeTextProvider : DateTimeTextProvider {
Expand Down
19 changes: 8 additions & 11 deletions core/src/darwinMain/kotlin/io/islandtime/internal/Concurrency.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package io.islandtime.internal
import kotlinx.cinterop.StableRef
import kotlin.native.concurrent.TransferMode
import kotlin.native.concurrent.Worker
import kotlin.native.concurrent.ensureNeverFrozen
import kotlin.native.concurrent.freeze

internal class WorkerConfined<T : Any>(
private val worker: Worker,
Expand All @@ -20,7 +18,7 @@ internal value class ConfinedValueRef<T : Any>(private val value: StableRef<T>)

companion object {
fun <T : Any> create(value: T): ConfinedValueRef<T> {
return ConfinedValueRef(StableRef.create(value.apply { ensureNeverFrozen() }))
return ConfinedValueRef(StableRef.create(value))
}
}
}
Expand All @@ -43,13 +41,12 @@ private inline fun <T> runOn(worker: Worker, crossinline block: () -> T): T {
private fun <T> Worker.executeImmediately(block: () -> T): T {
return execute(
TransferMode.SAFE,
{ block.freeze() },
{
try {
Result.success(it())
} catch (e: Throwable) {
Result.failure(e)
}.freeze()
{ block }
) {
try {
Result.success(it())
} catch (e: Throwable) {
Result.failure(e)
}
).result.getOrThrow()
}.result.getOrThrow()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import kotlinx.cinterop.convert
import platform.Foundation.*
import kotlin.native.concurrent.Worker

@SharedImmutable
private val worker = Worker.start(errorReporting = false)

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.7.10"
kotlin = "1.7.20"
dokka = "1.7.10"
serialization = "1.4.0"
atomicfu = "0.18.3"
Expand Down

0 comments on commit d2a725e

Please sign in to comment.