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:
Jason A. Donenfeld 2018-05-20 05:55:52 +02:00
parent b290cf05e3
commit 5e924e5407

View file

@ -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)
} }