当前位置: 首页>>代码示例>>C++>>正文


C++ Producer::start方法代码示例

本文整理汇总了C++中Producer::start方法的典型用法代码示例。如果您正苦于以下问题:C++ Producer::start方法的具体用法?C++ Producer::start怎么用?C++ Producer::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Producer的用法示例。


在下文中一共展示了Producer::start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: producerConsumer

void tst_QSemaphore::producerConsumer()
{
    Producer producer;
    Consumer consumer;
    producer.start();
    consumer.start();
    producer.wait();
    consumer.wait();
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:9,代码来源:tst_qsemaphore.cpp

示例2: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    Producer producer;
    producer.registerCallBack(callBackFunction);
    producer.start();
    producer.wait();
}
开发者ID:Ulle84,项目名称:UllesSourceCode,代码行数:11,代码来源:MainWindow.cpp

示例3: main

int main()
{
    usedSpace += BufferSize;

    Producer producer;
    Consumer consumer;
    producer.start();
    consumer.start();
    producer.wait();
    consumer.wait();
    return 0;
}
开发者ID:EleVenPerfect,项目名称:OTHERS,代码行数:12,代码来源:semaphores.cpp

示例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;
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:13,代码来源:waitconditions.cpp

示例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();
}
开发者ID:EleVenPerfect,项目名称:OTHERS,代码行数:15,代码来源:main.cpp

示例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();
}
开发者ID:yujiajia,项目名称:Just-Go,代码行数:16,代码来源:main.cpp

示例7: 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();
	
}
开发者ID:Nuurek,项目名称:Monitor,代码行数:17,代码来源:Main.cpp

示例8: 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();
}
开发者ID:HezhouW,项目名称:SQL-whz,代码行数:37,代码来源:main.cpp

示例9: if

int
main(int argc, char** argv)
{
 // char consumer_reg[100];
  int i=0;
  int flag_prod=0;
  int flag_cons=0;
  int check_flag=0;

  for(i=0;i<argc;i++)
  {
    if((strcmp(argv[i],"-p")==0)) 
      check_flag++;
    if((strcmp(argv[i],"-d")==0))
      check_flag++; 
  }
if(check_flag==1){
  for(i=1;i<argc;i++)
  {
	if((strcmp(argv[i],"-p")==0))
	{
		printf("In Producer\n");
		i=i+1;
		flag_prod=1;
		break;
	}
	if((strcmp(argv[i],"-d")==0))
	{
		printf("In Consumer\n");
		i=i+1;
		flag_cons=1;
		break;
	}
  }
  if(flag_prod==1)
{
	int j=0;
	  number_of_prod_files=argc-i;
          for(j=0;j<number_of_prod_files;j++)
          {
		strcpy(producer_reg[j],argv[i]);
		++i;
	  }
	  printf("Files in the Producer are as below\n");
          for(j=0;j<number_of_prod_files;j++)
	  {
		printf("%s\n",producer_reg[j]);
	  }
	  Producer p;
	  p.start();
          flag_prod=0;
 }
else  if(flag_cons==1)
 {
	int j=0;
        char string_to_send[800];
	  number_of_cons_files=argc-i;
          for(j=0;j<number_of_cons_files;j++)
          {
		memset(&string_to_send,0,sizeof(string_to_send));
                strcat(string_to_send,argv[i]);
                strcat(string_to_send,"/$");
		strcpy(consumer_reg[j],string_to_send);
		++i;
	  }
	  printf("Files in the Consumer are as below\n");
          for(j=0;j<number_of_cons_files;j++)
	  {
		printf("%s\n",consumer_reg[j]);
	  }


	Consumer c;
	c.start_c();
        flag_cons=0;
}
}
else if(check_flag==2)
{
  int p_index=0;
  int d_index=0;
  for(i=1;i<argc;i++)
  {
	 if((strcmp(argv[i],"-p")==0))
           p_index=i;
         if((strcmp(argv[i],"-d")==0))
           d_index=i;
         if(p_index!=0 && d_index!=0)
          break;
  }    	
  if(p_index<d_index && p_index!=0)
  {
    i=0;
    int j=0;
    for(j=p_index+1;j<d_index;j++)
    {
                strcpy(producer_reg[i],argv[j]);
                ++i;
     }
      number_of_prod_files=i;
//.........这里部分代码省略.........
开发者ID:shivani4,项目名称:FileSharingOverNDN,代码行数:101,代码来源:fshare.cpp

示例10: test

	static void test()
	{
		Producer thread;
		thread.start();
	}
开发者ID:knapiontek,项目名称:therion,代码行数:5,代码来源:testthread.hpp


注:本文中的Producer::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。