Deprecate monitorEnter and monitorExit not to be used from user code.
This commit is contained in:
@@ -20,8 +20,10 @@ import kotlin.jvm.internal.Intrinsic
|
|||||||
|
|
||||||
/** @suppress */
|
/** @suppress */
|
||||||
@Intrinsic("kotlin.jvm.internal.unsafe.monitorEnter")
|
@Intrinsic("kotlin.jvm.internal.unsafe.monitorEnter")
|
||||||
|
@Deprecated("This function supports the standard library infrastructure and is not intended to be used directly from user code.")
|
||||||
public fun monitorEnter(monitor: Any): Unit = throw UnsupportedOperationException("This function can only be used privately")
|
public fun monitorEnter(monitor: Any): Unit = throw UnsupportedOperationException("This function can only be used privately")
|
||||||
|
|
||||||
/** @suppress */
|
/** @suppress */
|
||||||
@Intrinsic("kotlin.jvm.internal.unsafe.monitorExit")
|
@Intrinsic("kotlin.jvm.internal.unsafe.monitorExit")
|
||||||
|
@Deprecated("This function supports the standard library infrastructure and is not intended to be used directly from user code.")
|
||||||
public fun monitorExit(monitor: Any): Unit = throw UnsupportedOperationException("This function can only be used privately")
|
public fun monitorExit(monitor: Any): Unit = throw UnsupportedOperationException("This function can only be used privately")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import kotlin.jvm.internal.unsafe.*
|
|||||||
/**
|
/**
|
||||||
* Executes the given function [block] while holding the monitor of the given object [lock].
|
* Executes the given function [block] while holding the monitor of the given object [lock].
|
||||||
*/
|
*/
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
public inline fun <R> synchronized(lock: Any, block: () -> R): R {
|
public inline fun <R> synchronized(lock: Any, block: () -> R): R {
|
||||||
monitorEnter(lock)
|
monitorEnter(lock)
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user