问题描述
用于MFC应用程序中的动态线程数组
CWinThread ** Thread;
UINT ParentTh()
{
......
int块;
cnt = 0;
Thread [cnt] =(CWinThread *)malloc(sizeof(CWinThread));//提供访问权限
.....
while(block> 0)
{
线程[cnt] = AfxBeginThread(Child1 ...)
cnt ++;
Thraed [cnt] = AfxBeginThread(child2 ...)
cnt ++;
}
....
请帮助...
用于无限线程分配
Thread [cnt] =(CWinThread *)malloc(sizeof(CWinThread));//dy内存用于1个线程
然后逐渐增加cnt到block * 2
For dynamic thread array in my MFC application
CWinThread **Thread;
UINT ParentTh()
{
......
int block;
cnt=0;
Thread[cnt]=(CWinThread *)malloc(sizeof(CWinThread));//gives access vilation
.....
while(block>0)
{
Thread[cnt]=AfxBeginThread(Child1...)
cnt++;
Thraed[cnt]=AfxBeginThread(child2...)
cnt++;
}
....
Plz help...
for unbounded thread allocation
Thread[cnt]=(CWinThread*)malloc(sizeof(CWinThread));//dy memory for 1 thread
and gradually the cnt increases upto block*2
推荐答案
这篇关于动态CWinThread数组中的访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!