#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <windows.h>
class Instance
{
public:
Instance()
{
this->thread();
};
private:
static int num;
static void run(int num)
{
printf("%d", num);
};
void thread();
};
int Instance::num = 1;
void Instance :: thread()
{
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)run, (LPVOID)this->num, 0, NULL);
}
int main (int argc, char *argv[])
{
Instance instance;
system ("pause");
return 0;
}
c++类中多线程的使用
最新推荐文章于 2024-07-26 17:42:57 发布