mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-03 13:34:27 +00:00
15 lines
270 B
Go
15 lines
270 B
Go
package gateway
|
|
|
|
import "sync/atomic"
|
|
|
|
type Sequence struct {
|
|
seq int64
|
|
}
|
|
|
|
func NewSequence() *Sequence {
|
|
return &Sequence{0}
|
|
}
|
|
|
|
func (s *Sequence) Set(seq int64) { atomic.StoreInt64(&s.seq, seq) }
|
|
func (s *Sequence) Get() int64 { return atomic.LoadInt64(&s.seq) }
|