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


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

本文整理汇总了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();
	
}
开发者ID:Nuurek,项目名称:Monitor,代码行数:17,代码来源:Main.cpp

示例2: 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

示例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: 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;
}
开发者ID:ntrifunovic,项目名称:ETF-OS1,代码行数:43,代码来源:user.cpp

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


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