Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 14-Apr-10 23:46pm
v2

1 solution

Show us the allocation of Thread[]. It probably isn't allocated.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900