@Suppress("TooManyFunctions")
class {{ class_name }} internal constructor(handle: Long) : AutoCloseable {
private val handleLock = Any()
private var nativeHandle: Long = handle
private inline fun <T> withHandle(block: (Long) -> T): T = synchronized(handleLock) {
check(nativeHandle != 0L) { "{{ class_name }} is closed" }
block(nativeHandle)
}