Volatile

    [Kotlin] @Volatile 키워드란?

    아래 코드는 Android developer 페이지의 Codelabs에서 제공하는 예시 코드이다. 해당 코드를 보면 Singleton 구현 시 변수에 @Volatile Annotation을 붙히는 것을 볼 수 있다. 이게 어떤의미 일까? // Annotates class to be a Room Database with a table (entity) of the Word class @Database(entities = arrayOf(Word::class), version = 1, exportSchema = false) public abstract class WordRoomDatabase : RoomDatabase() { abstract fun wordDao(): WordDao companion object..