mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
syncs: add AtomicUint32
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
733d52827b
commit
676e32ad72
@ -83,6 +83,17 @@ 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.
|
||||
|
Loading…
Reference in New Issue
Block a user