如何创建多个同名线程并各自运行!!!~有用......
在MFC中我需要如何的运行:
struct SP
{
int it;
int *src;
int **desc;
}
...
UNIT Treadabc(LPVOID pp)
{
SP *sp(SP*)pp;
...
}
void DLG::fun1()
{...
int *a=new int[3];
...
for(int i=1;i<5;i++)
{
SP *sp=new SP;
sp->it=i;
sp->src=a;
...
AfxBeginThread(Treadabc,pp);////////就想创建多个线程,各自运行
}
}
...
//////////////
//问题是好象只有得一个线程被创建..
而且
sp指针传递过去线程后,src和desc的值会失效..??