v0.0.271 return old value in AtomicBool::Set
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 53s

This commit is contained in:
Mike Schwörer 2023-09-26 14:32:45 +02:00
parent c63cf442f8
commit 9dffc41274
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 7 additions and 3 deletions

View File

@ -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"

View File

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