CSDN博客

img awzzz

任意类成员函数作为线程参数的封装ex

发表于2004/10/19 17:24:00  593人阅读

// ThreadHelper.cpp: implementation of the ThreadHelper class.
//
//////////////////////////////////////////////////////////////////////

#include "ThreadHelper.h"

#include <stdio.h>
#include <conio.h>

class a : public ThreadIF
{
 DWORD ThreadProc(void* param)
 {
  if (param) ::MessageBox(NULL, (char*)param, "ThreadHelper", MB_OK);
   else ::MessageBox(NULL, "a", "ThreadHelper", MB_OK);
  return 0;
 };
public:
 a()
 {
  ThreadStart();
 };
};

void main()
{
 ThreadIF_ex aa;
 aa.ThreadStart();

 a abc;
 a b;
 abc.ThreadStart("aaa");
 abc.ThreadStart("bbb");

 printf("abc.count(thread) = %d/r/n", abc.count());

 printf("press any key to exit/r/n");
 getch();
}

阅读全文
0 0

相关文章推荐

img
取 消
img