级别: 普通巫女
精华:
0
博丽神社喝茶券(威望): 0 张
春度: 37 最后登录: 2012-04-29
|
13楼
发表于: 2009-12-27 22:29
按照你的需求,我用fast delegate 弄了一个,也就是说的那种类封装参数和delegate的形式,用的我自己的线程浅封装,VC2008测试是可以的.只写了2层,下面的依次类推.相比起来我更加喜欢这种形式. 复制代码- #include <stdio.h>
- #include "yns/base/Thread.h"
- #include "FastDelegate/FastDelegate.h"
- using namespace fastdelegate;
- class FuncCallInterface
- {}
- virtual void call() = 0;
- };
- template <class Delegate>
- class FuncCall0 : public FuncCallInterface
- {}
- virtual void call()
- {}
- private :
- Delegate m_d;
- };
- template <class Delegate,class T0>
- class FuncCall1 : public FuncCallInterface
- {}
- virtual void call()
- {}
- private :
- Delegate m_d;
- T0 m_t0;
- };
- template <class Delegate,class T0,class T1>
- class FuncCall2 : public FuncCallInterface
- {}
- virtual void call()
- {}
- private :
- Delegate m_d;
- T0 m_t0;
- T1 m_t1;
- };
- unsigned int __stdcall ThreadFunction0 (FuncCallInterface * arg)
- {}
- template<class Func>
- int forkThread(Func d)
- {}
- template<class Obj,class Func>
- int forkThreadObj(Obj * o,Func d)
- {}
- template<class Func,class T0>
- int forkThread(Func d,T0 arg0)
- {}
- template<class Obj,class Func,class T0>
- int forkThreadObj(Obj * o,Func d,T0 arg0)
- {}
- template<class Func,class T0,class T1>
- int forkThread(Func d,T0 arg0,T1 arg1)
- {}
- template<class Obj,class Func,class T0,class T1>
- int forkThreadObj(Obj * o,Func d,T0 arg0,T1 arg1)
- {}
- void func(int a,int b)
- {}
- class A
- {}
- void func2(int i,int j)
- {}
- };
- int main()
- {}
|
3 5 21 32 111 222 请按任意键继续. . . [ 此帖被ryuka在2009-12-27 23:30重新编辑 ]
|