本文整理汇总了C++中Producer::wait方法的典型用法代码示例。如果您正苦于以下问题:C++ Producer::wait方法的具体用法?C++ Producer::wait怎么用?C++ Producer::wait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Producer
的用法示例。
在下文中一共展示了Producer::wait方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: producerConsumer
void tst_QSemaphore::producerConsumer()
{
Producer producer;
Consumer consumer;
producer.start();
consumer.start();
producer.wait();
consumer.wait();
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Producer producer;
producer.registerCallBack(callBackFunction);
producer.start();
producer.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: ACE_TMAIN
// Listing 4 code/ch14
int ACE_TMAIN (int, ACE_TCHAR *[])
{
int shared_buf[Q_SIZE];
SafeUInt in = 0;
SafeUInt out = 0;
Producer producer (shared_buf, in, out);
Consumer consumer (shared_buf, in, out);
producer.activate();
consumer.activate();
producer.wait();
consumer.wait();
return 0;
}
示例8: ACE_TMAIN
// Listing 1
// Listing 3 code/ch14
int ACE_TMAIN (int, ACE_TCHAR *[])
{
ACE_Semaphore psem (5);
ACE_Semaphore csem (0);
Consumer consumer (psem, csem);
Producer producer (psem, csem, consumer);
producer.activate ();
consumer.activate (THR_NEW_LWP | THR_JOINABLE,
Consumer::N_THREADS);
producer.wait ();
consumer.wait ();
return 0;
}
示例9: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
initaldatabase();//初始化数据库
QSqlDatabase::removeDatabase("first");
Producer producer;
producer.start();
SqlwriteThread_buffer *threadvector[THREADNUM];
for(int i=0; i< THREADNUM; ++i)
{
threadvector[i] = new SqlwriteThread_buffer("localhost","whztest","root","infonet313",i);
// threadvector[i]->SetRange(1024*10);
}
QTime t;
t.start();
for(int i=0; i< THREADNUM; ++i)
{
threadvector[i]->start();
}
QTime blankspace;
blankspace.start();
for(int i=0; i< THREADNUM; ++i)
{
qDebug()<<QObject::trUtf8("第 %1 个线程和第 %2 个线程之间等待耗时:%3 ms").arg(i).arg(i+1).arg(blankspace.elapsed());
threadvector[i]->wait();
blankspace.restart();
}
producer.wait();
qDebug()<<QObject::trUtf8("插入 %1 条记录,耗时:%2 ms").arg(1024*100).arg(t.elapsed());
exit(0);
return a.exec();
}