-
September 20th, 2010, 02:08 PM
#1
Create threads
-
September 20th, 2010, 02:26 PM
#2
Re: Create threads
I have no idea what you are trying to ask but...
Code:
Fun *p = NULL;
p.AllocThread(n);
I am guessing you are getting a compiler error here.
First, you say is is a pointer to nothing.
Then you try to access p (even though you just said it points to nothing) with the . operator.
Code:
Fun *p = new Fun();
???
-
September 20th, 2010, 02:38 PM
#3
Re: Create threads
Thanks
I'm trying to create n threads. It fails at AllocThread's new
-
September 20th, 2010, 02:54 PM
#4
Re: Create threads
I don't think you have to call new...
AfxBeginThread returns a pointer to the thread object... it already creates it for you
I'd actually keep a list of the threads.
Get rid of the AllocThread function.
Code:
void Function::Loop(int n)
{
std::list<CWinThread*> pt_list;
for(int i=0;i<n;i++)
{
CWinThread *pt = afxbeginthread(xxxxxxxx);
pt_list.push_back(pt);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|