Skip to content

Commit

Permalink
Fix potential preferences race condition with multithreading
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislo27 committed Oct 4, 2020
1 parent db57221 commit ac0bd8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class RHRE3Application(logger: Logger, logToFile: File?)
Color(0f, 0.5f, 0.5f, 0.75f))
}

@Volatile
lateinit var preferences: Preferences
private set

Expand Down
1 change: 1 addition & 0 deletions core/src/main/kotlin/io/github/chrislo27/rhre3/lc/LC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class LC(val main: RHRE3Application) {

fun all() {
thread(start = true, isDaemon = true) {
Thread.sleep(1_000L)
while (!lc()) {
Thread.sleep(5 * 60_000L)
}
Expand Down

0 comments on commit ac0bd8f

Please sign in to comment.