我想动态申请N个线程,N的大小已经计算出,可是下面的方法一运行就出错,是否有别的方法
CWinThread **m_pThread;
for(int i=0; i < N; i++){
m_pThread[i] = new CWinThread(); //这一步就出错,“程序非法运行”
m_pThread[i] = AfxBeginThread(fun,this,THREAD_PRIORITY_NORMAL,0,0);}
CWinThread **m_pThread;
for(int i=0; i < N; i++){
m_pThread[i] = new CWinThread(); //这一步就出错,“程序非法运行”
m_pThread[i] = AfxBeginThread(fun,this,THREAD_PRIORITY_NORMAL,0,0);}
CWinThread **m_pThread = new CWinThread*[n];...
for(int i =0; i < N; i ++)
{
m_pThread[i] = AfxBeginThread(...);
}
Win32 api function:CreateThread
C Runtime function:_beginthread,_beginthreadex