TickWorker.cpp 468 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. Block* zTickBlock = queue->zNextBlock(waiting);
  17. while (zTickBlock)
  18. {
  19. zTickBlock->tick(queue);
  20. zTickBlock = queue->zNextBlock(waiting);
  21. }
  22. }
  23. bool TickWorker::isWaiting() const
  24. {
  25. return waiting;
  26. }