mirror of https://github.com/perkeep/perkeep.git
types: add an Atomic64 type
Change-Id: I4677b4368b98e658b921697331d999b58de85d7f
This commit is contained in:
parent
1149058dbd
commit
2789f65d1f
|
@ -37,3 +37,19 @@ func (b *AtomicBool) Set(v bool) {
|
|||
}
|
||||
atomic.StoreUint32(&b.v, 0)
|
||||
}
|
||||
|
||||
type AtomicInt64 struct {
|
||||
v int64
|
||||
}
|
||||
|
||||
func (a *AtomicInt64) Get() int64 {
|
||||
return atomic.LoadInt64(&a.v)
|
||||
}
|
||||
|
||||
func (a *AtomicInt64) Set(v int64) {
|
||||
atomic.StoreInt64(&a.v, v)
|
||||
}
|
||||
|
||||
func (a *AtomicInt64) Add(delta int64) int64 {
|
||||
return atomic.AddInt64(&a.v, delta)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue