Or instead of `@Syncrhonized` (which will always s...
# announcements
m
Or instead of
@Syncrhonized
(which will always synchronize instead of using double-checked locking like
Lazy
), how about using
lazy
with a
lateinit var
for the
applicationContext
?
Copy code
companion object {
    private lateinit var applicationContext: Context
    private val rs: RenderScript by lazy { RenderScript.create(applicationContext) }

    private fun getRenderScriptSingleton(c: Context): RenderScript {
        applicationContext = c.applicationContext
        return rs
    }
}