Skip to content

Commit

Permalink
Start InterruptibleSource in UNINTERRUPTIBLE state. (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite authored Aug 28, 2020
1 parent 2dd9737 commit b3bc498
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions coil-base/src/main/java/coil/decode/InterruptibleSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal class InterruptibleSource(
delegate: Source
) : ForwardingSource(delegate), CompletionHandler {

private val _state = AtomicInteger(WORKING)
private val _state = AtomicInteger(UNINTERRUPTIBLE)
private val targetThread = Thread.currentThread()

init {
Expand All @@ -64,8 +64,8 @@ internal class InterruptibleSource(
run {
_state.loop { state ->
when (state) {
WORKING -> if (_state.compareAndSet(state, WORKING)) return@run
INTERRUPTING, INTERRUPTED -> return@run
UNINTERRUPTIBLE -> if (_state.compareAndSet(state, UNINTERRUPTIBLE)) return@run
PENDING, INTERRUPTING, INTERRUPTED -> return@run
else -> invalidState(state)
}
}
Expand Down

0 comments on commit b3bc498

Please sign in to comment.