All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.dokar.quickjs.util.Mutex.ext.kt Maven / Gradle / Ivy

The newest version!
package com.dokar.quickjs.util

import kotlinx.coroutines.sync.Mutex

internal inline fun  Mutex.withLockSync(
    block: () -> T,
): T {
    try {
        while (!this.tryLock()) {
            // Loop until the lock is available
        }
        return block()
    } finally {
        this.unlock()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy