void run() { while(!count->isPaused()) { ++number; { ostringstream os; os << *this << " Total: " << count->increment() << endl; display->output(os); } Thread::sleep(100); } waitingForCancel = true; while(!count->isCanceled()) // Hold here... Thread::sleep(100); ostringstream os; os << "Terminating " << *this << endl; display->output(os); }
int getValue() { while(count->isPaused() && !waitingForCancel) Thread::sleep(100); return number; }