SJA工艺
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
452 B

3 years ago
  1. package Engine
  2. import (
  3. "LAPP_SJA_ME/web/models"
  4. )
  5. // 运行调度器,从管道获取打印任务并分发给对应的打印机
  6. func StartScheduler(inChan chan models.PrintTask, prnDict map[string]*Printer) {
  7. // 从管道获取打印任务并分发
  8. go func() {
  9. var (
  10. prn *Printer
  11. ok bool
  12. t models.PrintTask
  13. )
  14. for {
  15. t = <-inChan
  16. if prn, ok = prnDict[t.PrinterId]; !ok {
  17. continue
  18. }
  19. prn.InTaskChan <- t
  20. }
  21. }()
  22. }