pool.go 461 B

123456789101112131415161718192021222324
  1. package init
  2. import "log"
  3. func NoLoginPoolInit(poolSwitch bool, do, wait int) {
  4. if poolSwitch {
  5. //创建执行池 等待池
  6. doPool := make(chan struct{}, do)
  7. for i := 0; i < do; i++ {
  8. doPool <- struct{}{}
  9. }
  10. waitPool := make(chan struct{}, wait)
  11. for i := 0; i < wait; i++ {
  12. waitPool <- struct{}{}
  13. }
  14. ReqLimitInit = &ReqLimit{
  15. DoPool: doPool,
  16. WaitPool: waitPool,
  17. }
  18. } else {
  19. log.Println("未登录搜索限制未打开")
  20. }
  21. }