Compare commits

...

2 Commits

Author SHA1 Message Date
Robinson be2dfae824
Updated version 2023-07-12 17:21:29 +02:00
Robinson 9c8f6c97dc
Added mutex.safeUnlock 2023-07-12 17:20:48 +02:00
3 changed files with 8 additions and 2 deletions

View File

@ -35,7 +35,7 @@ object Extras {
// set for the project
const val description = "Utilities for use within Java projects"
const val group = "com.dorkbox"
const val version = "1.42"
const val version = "1.43"
// set as project.ext
const val name = "Utilities"

View File

@ -66,6 +66,12 @@ inline fun ignoreExceptions(vararg blocks: () -> Unit) {
}
}
fun Mutex.safeUnlock() {
if (isLocked) {
unlock()
}
}
// From: https://elizarov.medium.com/phantom-of-the-coroutine-afc63b03a131
suspend inline fun <T> Mutex.withReentrantLock(crossinline block: suspend () -> T): T {
val key = ReentrantMutexContextKey(this)

View File

@ -27,7 +27,7 @@ object Sys {
/**
* Gets the version number.
*/
val version = "1.42"
val version = "1.43"
init {
// Add this project to the updates system, which verifies this class + UUID + version information