package lock_free import "time" // Options 无锁队列选项 type Options struct { gap time.Duration } type Option func(*Options) func loadOptions(opt ...Option) Options { opts := Options{ gap: time.Millisecond, } for _, o := range opt { o(&opts) } return opts } func WithGap(gap time.Duration) Option { return func(o *Options) { o.gap = gap } }