Consider the following code in Kotlin:
private val mLock = "lock"
suspend fun doJob(): String {
synchronized(mLock) {
if (someBoolean1) {
return "A"
}
if (someBoolean2) {
return@synchronized "B"
}
return@synchronized "C"
}
return "D"
}
Will the single return "A", that exits the doJob
function from within the synchronized
block, finish the synchronized block correctly? Could there be any issues with a set up like that one?