wqw
来源:互联网 发布:手机h5页面制作软件 编辑:程序博客网 时间:2024/04/30 13:42
#include "stdafx.h"
#include <iostream>
#include "zthread/PoolExecutor.h"
#include "zthread/ThreadedExecutor.h"
#include "zthread/ConcurrentExecutor.h"
#include "zthread/SynchronousExecutor.h"
#include "zthread/Runnable.h"
#include "zthread/PoolExecutor.h"
using namespace ZThread;
using namespace std;
class LiftOff : public Runnable
{
public:
LiftOff(int count, int idn = 0): countDown(count), id(idn) {}
~LiftOff()
{
cout<< id << " competed" <<endl;
}
void run()
{
while (countDown--)
{
cout << id << " : " <<countDown <<endl;
}
cout<<"LiftOff!" <<endl;
}
private:
int countDown;
int id;
};
int _tmain(int argc, _TCHAR* argv[])
{
try
{
//ThreadedExecutor executor;
//PoolExecutor executor(5);
//ConcurrentExecutor executor;
SynchronousExecutor executor;
for (int i = 0; i < 5; i++)
{
executor.execute(new LiftOff(10, i));
}
cout <<"Waiting for LiftOff" <<endl;
}
catch (Synchronization_Exception& e)
{
cerr << e.what() <<endl;
}
cin.get();
return 0;
#include <iostream>
#include "zthread/PoolExecutor.h"
#include "zthread/ThreadedExecutor.h"
#include "zthread/ConcurrentExecutor.h"
#include "zthread/SynchronousExecutor.h"
#include "zthread/Runnable.h"
#include "zthread/PoolExecutor.h"
using namespace ZThread;
using namespace std;
class LiftOff : public Runnable
{
public:
LiftOff(int count, int idn = 0): countDown(count), id(idn) {}
~LiftOff()
{
cout<< id << " competed" <<endl;
}
void run()
{
while (countDown--)
{
cout << id << " : " <<countDown <<endl;
}
cout<<"LiftOff!" <<endl;
}
private:
int countDown;
int id;
};
int _tmain(int argc, _TCHAR* argv[])
{
try
{
//ThreadedExecutor executor;
//PoolExecutor executor(5);
//ConcurrentExecutor executor;
SynchronousExecutor executor;
for (int i = 0; i < 5; i++)
{
executor.execute(new LiftOff(10, i));
}
cout <<"Waiting for LiftOff" <<endl;
}
catch (Synchronization_Exception& e)
{
cerr << e.what() <<endl;
}
cin.get();
return 0;
0 0
- wqw
- nike真假 mDRr 4Wqw ZtgH
- 急!!!谁有微趣网的源码(www.wqw.cc)像这样的。
- iOS类别(Category)与扩展(Extension)
- Eclipse创建Maven Project和Maven Module
- Linux如何修改主机名
- 新浪笔试题(二)
- flickr的分表全局唯一id实现方式
- wqw
- Android开发中如何保存用户名密码在本地
- leetcode笔记--Delete Node in a Linked List
- vector 的删除操作pop_back、erase效率对比 http://blog.csdn.net/efeics/article/details/8059690
- Masonry使用
- android中ListView performItemClick()方法参数说明
- IOS开发证书变成“此证书的签发者无效”解决方法
- Android数据库高手秘籍(五)——LitePal的存储操作
- Java笔记--面试题