From 9dffc4127464ca4003b57cdf69b4a428ea199dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Tue, 26 Sep 2023 14:32:45 +0200 Subject: [PATCH] v0.0.271 return old value in AtomicBool::Set --- goextVersion.go | 4 ++-- syncext/atomic.go | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/goextVersion.go b/goextVersion.go index 6ff4f15..d475aae 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ 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" diff --git a/syncext/atomic.go b/syncext/atomic.go index e9228f2..9c482ec 100644 --- a/syncext/atomic.go +++ b/syncext/atomic.go @@ -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) {