v0.0.271 return old value in AtomicBool::Set
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 53s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 53s
This commit is contained in:
parent
c63cf442f8
commit
9dffc41274
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.270"
|
const GoextVersion = "0.0.271"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-09-25T11:35:03+0200"
|
const GoextVersionTimestamp = "2023-09-26T14:32:45+0200"
|
||||||
|
@ -27,10 +27,12 @@ func (a *AtomicBool) Get() bool {
|
|||||||
return a.v
|
return a.v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AtomicBool) Set(value bool) {
|
func (a *AtomicBool) Set(value bool) bool {
|
||||||
a.lock.Lock()
|
a.lock.Lock()
|
||||||
defer a.lock.Unlock()
|
defer a.lock.Unlock()
|
||||||
|
|
||||||
|
oldValue := a.v
|
||||||
|
|
||||||
a.v = value
|
a.v = value
|
||||||
|
|
||||||
for k, v := range a.listener {
|
for k, v := range a.listener {
|
||||||
@ -42,6 +44,8 @@ func (a *AtomicBool) Set(value bool) {
|
|||||||
delete(a.listener, k)
|
delete(a.listener, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return oldValue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AtomicBool) Wait(waitFor bool) {
|
func (a *AtomicBool) Wait(waitFor bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user