diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2022-08-03 21:51:02 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2022-08-03 21:51:42 -0700 |
| commit | 698defd54b4128eaa8278ff4ef1e15370682f1fe (patch) | |
| tree | db4eadf5e0cacc3176ee4e26511a3ef28a8dbd38 /syncs | |
| parent | c378a9900c56b33b6f7174894d8261d189e97185 (diff) | |
| download | tailscale-bradfitz/appendf.tar.xz tailscale-bradfitz/appendf.zip | |
syncs, all: move to using Go's new atomic types instead of oursbradfitz/appendf
Fixes #5185
Change-Id: I850dd532559af78c3895e2924f8237ccc328449d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'syncs')
| -rw-r--r-- | syncs/syncs.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/syncs/syncs.go b/syncs/syncs.go index 1f0558865..af9943632 100644 --- a/syncs/syncs.go +++ b/syncs/syncs.go @@ -68,42 +68,6 @@ func (wg *WaitGroupChan) Decr() { // Wait blocks until the WaitGroupChan counter is zero. func (wg *WaitGroupChan) Wait() { <-wg.done } -// AtomicBool is an atomic boolean. -type AtomicBool int32 - -func (b *AtomicBool) Set(v bool) { - var n int32 - if v { - n = 1 - } - atomic.StoreInt32((*int32)(b), n) -} - -// Swap sets b to v and reports whether it changed. -func (b *AtomicBool) Swap(v bool) (changed bool) { - var n int32 - if v { - n = 1 - } - old := atomic.SwapInt32((*int32)(b), n) - return old != n -} - -func (b *AtomicBool) Get() bool { - return atomic.LoadInt32((*int32)(b)) != 0 -} - -// AtomicUint32 is an atomic uint32. -type AtomicUint32 uint32 - -func (b *AtomicUint32) Set(v uint32) { - atomic.StoreUint32((*uint32)(b), v) -} - -func (b *AtomicUint32) Get() uint32 { - return atomic.LoadUint32((*uint32)(b)) -} - // Semaphore is a counting semaphore. // // Use NewSemaphore to create one. |
