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

jsAndWasmSharedMain.com.strumenta.antlrkotlin.runtime.Synchronized.kt Maven / Gradle / Ivy

// Copyright 2017-present Strumenta and contributors, licensed under Apache 2.0.
// Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause.
package com.strumenta.antlrkotlin.runtime

import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

// Not necessary for JavaScript. Single threaded.
@OptIn(ExperimentalContracts::class)
public actual inline fun  synchronized(lock: Any, block: () -> R): R {
  contract {
    callsInPlace(block, InvocationKind.EXACTLY_ONCE)
  }

  return block()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy