lens @ 72ec551e6cb422531e543e3fb431324aed5ac025

 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}