动态CWinThread数组中的访问冲突 [英] Access Violation in Dynamic CWinThread Array

查看:62
本文介绍了动态CWinThread数组中的访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于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

推荐答案

向我们展示Thread []的分配.可能没有分配.
Show us the allocation of Thread[]. It probably isn''t allocated.


这篇关于动态CWinThread数组中的访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆