1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +00:00
arikawa/gateway/sequence.go

13 lines
275 B
Go
Raw Normal View History

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