bartvh
11/15/2018, 2:05 PMobject
), which cannot be constructed elsewhere without reflection, but I can't seem to get it any tighter than inner
. Making it private
will not allow to me create the one instance:
inner class TheLock internal constructor()
private val theLockInstance = TheLock()
inline fun <T> synced(block: (TheLock) -> T) =
synchronized(this) {
block(theLockInstance)
}
karelpeeters
11/15/2018, 2:09 PM