Example #1
0
// NewMemQueue returns a new wait queue that holds at most max items.
func NewMemQueue(max int) queue.WaitQueue {
	q := &MemQueue{
		max: max,
	}
	q.popCond = sync.NewCond(&q.mu)
	q.pushCond = sync.NewCond(&q.mu)
	return queue.WithChannel(q)
}
Example #2
0
// NewWaitQueue creates a rate limit wait queue.
func NewWaitQueue(opt *Option) queue.WaitQueue {
	return queue.WithChannel(New(opt))
}