lens @ a98acb9c8b86a2c2f35841c86d3c3f1d7c176b61

 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}