void run() { try { while(IThr

Автор admin Суббота, 27 июня 2009 11:32

bisexual Kiev escort agency with sexy girls .

void run() { try { while(IThread::interrupted()) { // Блокировка до появления следующего тоста: Toast t = dryQueue->get(): t.butterO; cout « t « endl; butteredQueue->put(t); } } catch(Interrupted_Exception&) { /* Exit */ } cout « “Butterer off” « endl; } 580 Глава 11 • Многопоточное программирование }: // Нанесение джема на тост с маслом: class Jammer : public Runnable { ToastQueue butteredQueue. finishedQueue: public: Jammer(ToastQueue& buttered, ToastQueueS finished) : butteredQueue(buttered). finishedQueue(finished) {} void run() { try { while(!Thread::interrupted()) { // Блокировка до появления следующего тоста: Toast t = butteredQueue->get(): t.jamO: cout « t « endl: finishedQueue->put(t): } } catch(Interrupted_Exception&) { /* Exit */ } cout « “Jammer off” « endl: } // Потребление тоста: class Eater : public Runnable { ToastQueue finishedQueue: int counter: public: Eater(ToastQueue& finished) : finishedQueueCfinished). counter(O) {} void run() { try { while( IThread::interruptedO) { // Блокировка до появления следующего тоста: Toast t = finishedQueue->get(): // Убеждаемся в том, что тосты следу


Комментарии закрыты.