12345678910111213141516171819202122232425262728293031323334353637 |
- #include "TickWorker.h"
- #include <sys/syscall.h>
- #include <unistd.h>
- #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;
- tid = (pid_t)syscall(SYS_gettid);
- Framework::Text txt = Framework::Text("exiting tick worker ") + tid + "\n";
- std::cout << txt.getText();
- }
- bool TickWorker::isWaiting() const
- {
- return waiting;
- }
|