本文整理汇总了C++中Consumer::start方法的典型用法代码示例。如果您正苦于以下问题:C++ Consumer::start方法的具体用法?C++ Consumer::start怎么用?C++ Consumer::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Consumer
的用法示例。
在下文中一共展示了Consumer::start方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
ProducerConsumerMonitor monitor;
Producer producer = Producer(&monitor);
producer.start();
Consumer consumer = Consumer(&monitor);
consumer.start();
Consumer anotherConsumer = Consumer(&monitor);
anotherConsumer.start();
producer.waitFor();
consumer.waitFor();
anotherConsumer.waitFor();
}
示例2: producerConsumer
void tst_QSemaphore::producerConsumer()
{
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
}
示例3: main
int main()
{
usedSpace += BufferSize;
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return 0;
}
示例4: main
//! [5]
int main(int argc, char *argv[])
//! [5] //! [6]
{
QCoreApplication app(argc, argv);
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return 0;
}
示例5: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
return a.exec();
}
示例6: main
int main(int argc, char *argv[])
{
//QApplication app(argc, argv);
//Window *w = new Window;
//w->resize(300, 300);
//w->show();
//return app.exec();
QApplication app(argc, argv);
Producer produer;
Consumer consumer;
produer.start();
consumer.start();
produer.wait();
consumer.wait();
return app.exec();
}
示例7: userMain
int userMain (int argc, char* argv[])
{
TName producerName = "producerx";
BoundedBuffer *buff;
Consumer *con;
intLock
buff = new BoundedBuffer(atoi(argv[1]));
N = atoi(argv[2]);
N = N>19 ? 19 : N;
TIME_SLICE = atoi(argv[3]);
Producer **pro = new Producer*[N];
KeyboardEvent* kev;
int i;
con = new Consumer(buff);
con->start();
for (i=0; i<N; i++){
producerName[8]='0'+i;
pro[i] = new Producer(buff, producerName ,'0'+i, TIME_SLICE);
pro[i]->start();
}
kev = new KeyboardEvent(buff);
intUnlock
kev->start();
for (i=0; i<N; i++){
delete pro[i];
}
delete [] pro;
delete kev;
delete con;
intLock
cout<<"Kraj userMain"<<endl;
intUnlock
return 0;
}
示例8: test1
//------------------------------------------------------------------------------
void test1()
{
// Initialization
Consumer consumer;
// Made to order
Hamburger hamb;
Coke coke;
// Feed me
consumer.eat( hamb, coke );
// Make another order
hamb.makePlain();
coke.size( 44 );
// Deliver
consumer.eat( hamb, coke );
// Eat up!
consumer.start();
}