1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-05 06:26:08 +00:00
arikawa/internal/moreatomic/serial.go
Maximilian von Lindern 32789bb6e2 *: Separate utils and internal (#129)
* Utils: move package utils/heart to internal/heart

* Utils: move package utils/moreatomic to internal/moreatomic

* Utils: move package utils/zlib to internal/zlib
2020-07-29 16:58:33 -07:00

17 lines
235 B
Go

package moreatomic
import "sync/atomic"
type Serial struct {
serial uint32
}
func (s *Serial) Get() int {
return int(atomic.LoadUint32(&s.serial))
}
func (s *Serial) Incr() int {
atomic.AddUint32(&s.serial, 1)
return s.Get()
}