lens @ 91d413b3a15a15fd8b710d8f5a1532d2e3de6f05

 1package worker
 2
 3type Scheduler struct {
 4	pool chan any
 5}
 6
 7func NewScheduler(count uint) *Scheduler {
 8	return &Scheduler{
 9		pool: make(chan any, count),
10	}
11}
12
13func (self *Scheduler) Take() {
14	self.pool <- nil
15}
16
17func (self *Scheduler) Return() {
18	<-self.pool
19}