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:
2023-09-26 14:32:45 +02:00
parent c63cf442f8
commit 9dffc41274
2 changed files with 7 additions and 3 deletions

View File

@@ -27,10 +27,12 @@ func (a *AtomicBool) Get() bool {
return a.v
}
func (a *AtomicBool) Set(value bool) {
func (a *AtomicBool) Set(value bool) bool {
a.lock.Lock()
defer a.lock.Unlock()
oldValue := a.v
a.v = value
for k, v := range a.listener {
@@ -42,6 +44,8 @@ func (a *AtomicBool) Set(value bool) {
delete(a.listener, k)
}
}
return oldValue
}
func (a *AtomicBool) Wait(waitFor bool) {