Skip to content

Commit

Permalink
updatehub: Fix race condition in GetState
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Gustavo S. Barreto <gustavo@ossystems.com.br>
  • Loading branch information
gustavosbarreto authored and otavio committed Jul 12, 2018
1 parent 7320d3c commit 5de10ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions updatehub/updatehub.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func (uh *UpdateHub) Cancel(nextState State) {
}

func (uh *UpdateHub) GetState() State {
uh.stateMutex.Lock()
defer uh.stateMutex.Unlock()

return uh.state
}

Expand Down

0 comments on commit 5de10ab

Please sign in to comment.