feudal/sequence/serial.go

17 lines
270 B
Go
Raw Permalink Normal View History

2024-04-04 19:43:46 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package sequence
import (
"sync/atomic"
)
type Serial32 func() uint32
func NewSerial32() Serial32 {
var c uint32 = 0
return func() uint32 { return atomic.AddUint32(&c, 1) }
}