Avoid deadlock when the mutex isn't required, since these are atomics
Maybe this fixes the "double lock issue" in f73d2fb2d96bc3fbc8bc4cce452e3c19689de01e?
This commit is contained in:
parent
b290cf05e3
commit
5e924e5407
|
@ -162,16 +162,12 @@ func (device *Device) Up() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
device.state.mutex.Lock()
|
|
||||||
device.isUp.Set(true)
|
device.isUp.Set(true)
|
||||||
device.state.mutex.Unlock()
|
|
||||||
deviceUpdateState(device)
|
deviceUpdateState(device)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (device *Device) Down() {
|
func (device *Device) Down() {
|
||||||
device.state.mutex.Lock()
|
|
||||||
device.isUp.Set(false)
|
device.isUp.Set(false)
|
||||||
device.state.mutex.Unlock()
|
|
||||||
deviceUpdateState(device)
|
deviceUpdateState(device)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue