synchronize If
inline fun <R> A_BasicObject.synchronizeIf(syncCondition: Boolean, body: A_BasicObject.() -> R): R
Content copied to clipboard
If the provided condition is true, synchronize with the receiver's monitor around the execution of the body function. Otherwise, run the body function without synchronization.
Receiver
The result of running the body.
Parameters
R
The type of result produced by the body, if any.
sync Condition
Whether to synchronize on the receiver's monitor.
body
The body to run, either synchronized or unsynchronized.