#include "TickWorker.h" #ifndef _WINDOWS # include # include #else # define pid_t int #endif #include "Block.h" TickWorker::TickWorker(TickQueue* queue) : Thread(), queue(queue), waiting(0) { start(); } TickWorker::~TickWorker() {} void TickWorker::thread() { Tickable* zTick = queue->zNext(waiting); while (zTick) { zTick->tick(queue); zTick = queue->zNext(waiting); } // do not use multiple << here because they are not printed at once with // multiple threads pid_t tid; #ifdef _WINDOWS tid = (int)(__int64)getThreadHandle(); #else tid = (pid_t)syscall(SYS_gettid); #endif Framework::Text txt = Framework::Text("exiting tick worker ") + tid + "\n"; std::cout << txt.getText() << std::flush; } bool TickWorker::isWaiting() const { return waiting; }