1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-08 16:04:41 +00:00
arikawa/gateway/sequence.go

15 lines
276 B
Go
Raw Normal View History

2020-01-15 04:43:34 +00:00
package gateway
import "sync/atomic"
type Sequence struct {
seq *int64
}
func NewSequence() Sequence {
return Sequence{new(int64)}
}
func (s *Sequence) Set(seq int64) { atomic.StoreInt64(s.seq, seq) }
func (s *Sequence) Get() int64 { return atomic.LoadInt64(s.seq) }