SJA APS后端代码
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
447 B

  1. package Engine
  2. import (
  3. "leit.com/leit_seat_aps/db"
  4. )
  5. // 运行调度器,从管道获取打印任务并分发给对应的打印机
  6. func StartScheduler(inChan chan db.PrintTask, prnDict map[string]*Printer) {
  7. // 从管道获取打印任务并分发
  8. go func() {
  9. var (
  10. prn *Printer
  11. ok bool
  12. t db.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. }