Worker.py 989 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python
  2. from threading import Thread, Lock
  3. import time
  4. from aman.config.Airport import Airport
  5. class Worker(Thread):
  6. def __init__(self):
  7. Thread.__init__(self)
  8. def __del__(self):
  9. self.release()
  10. def acquire(self, icao : str, configuration : Airport):
  11. self.stopThread = None
  12. self.icao = icao
  13. self.configuration = configuration
  14. self.arrivalRoutes = configuration.gngData.arrivalRoutes
  15. self.updateLock = Lock()
  16. self.reportQueue = {}
  17. self.start()
  18. def release(self):
  19. self.stopThread = True
  20. self.join()
  21. def run(self):
  22. counter = 0
  23. while None == self.stopThread:
  24. time.sleep(1)
  25. counter += 1
  26. if 0 != (counter % 60):
  27. continue
  28. # TODO handle the report queue and update internal information
  29. # TODO execute planning, etc.
  30. continue