TickWorker.cpp 441 B

12345678910111213141516171819202122232425262728293031
  1. #include "TickWorker.h"
  2. #include "Block.h"
  3. TickWorker::TickWorker(TickQueue* queue)
  4. : Thread(),
  5. queue(queue),
  6. waiting(0)
  7. {
  8. start();
  9. }
  10. TickWorker::~TickWorker()
  11. {
  12. queue->release();
  13. }
  14. void TickWorker::thread()
  15. {
  16. Tickable* zTick = queue->zNext(waiting);
  17. while (zTick)
  18. {
  19. zTick->tick(queue);
  20. zTick = queue->zNext(waiting);
  21. }
  22. }
  23. bool TickWorker::isWaiting() const
  24. {
  25. return waiting;
  26. }