Click here to Skip to main content
15,884,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multithreading help in C++ Pin
Stuart Dootson30-Apr-09 6:16
professionalStuart Dootson30-Apr-09 6:16 
GeneralRe: Multithreading help in C++ Pin
Kiran Satish30-Apr-09 6:50
Kiran Satish30-Apr-09 6:50 
GeneralRe: Multithreading help in C++ Pin
Stuart Dootson30-Apr-09 6:55
professionalStuart Dootson30-Apr-09 6:55 
AnswerRe: Multithreading help in C++ Pin
KarstenK29-Apr-09 21:17
mveKarstenK29-Apr-09 21:17 
GeneralRe: Multithreading help in C++ Pin
Kiran Satish30-Apr-09 3:27
Kiran Satish30-Apr-09 3:27 
GeneralRe: Multithreading help in C++ Pin
KarstenK30-Apr-09 3:43
mveKarstenK30-Apr-09 3:43 
GeneralRe: Multithreading help in C++ Pin
Kiran Satish30-Apr-09 5:03
Kiran Satish30-Apr-09 5:03 
AnswerRe: Multithreading help in C++ Pin
Joe Woodbury30-Apr-09 19:35
professionalJoe Woodbury30-Apr-09 19:35 
for (unsigned int i=0; i < m_nThreads-1; i++ )
thd_handle[i] = CreateThread(NULL, GenerateThread, &i, 0, NULL);


The problem is that you are taking the address of i and passing it to the thread function. However, by the time the thread function is able to start, i has likely changed and is probably invalid.

Since all you need is the actual value, just pass i (by casting it to LPVOID), and then in the thread function just pass param to CreateResult by casting it to a DWORD.

(I also don't understand why you keep subtracting one from your thread count. Why not just use the correct number to begin with?)


Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke


QuestionHow can I make a combobox without using MFC Pin
CodingLover29-Apr-09 16:24
CodingLover29-Apr-09 16:24 
AnswerRe: How can I make a combobox without using MFC Pin
Naveen29-Apr-09 17:56
Naveen29-Apr-09 17:56 
QuestionCTreeCtrl - Get the number of the selected item Pin
Gagnon Claude29-Apr-09 8:42
Gagnon Claude29-Apr-09 8:42 
QuestionRe: CTreeCtrl - Get the number of the selected item Pin
David Crow29-Apr-09 9:52
David Crow29-Apr-09 9:52 
AnswerRe: CTreeCtrl - Get the number of the selected item Pin
Stuart Dootson29-Apr-09 10:51
professionalStuart Dootson29-Apr-09 10:51 
GeneralRe: CTreeCtrl - Get the number of the selected item Pin
led mike29-Apr-09 11:10
led mike29-Apr-09 11:10 
GeneralRe: CTreeCtrl - Get the number of the selected item Pin
Stuart Dootson29-Apr-09 11:48
professionalStuart Dootson29-Apr-09 11:48 
QuestionFormatting A Rich edit control content in Editstream CallBack function Pin
ForNow29-Apr-09 5:52
ForNow29-Apr-09 5:52 
AnswerRe: Formatting A Rich edit control content in Editstream CallBack function Pin
David Crow29-Apr-09 6:37
David Crow29-Apr-09 6:37 
AnswerRe: Formatting A Rich edit control content in Editstream CallBack function Pin
Stuart Dootson29-Apr-09 7:28
professionalStuart Dootson29-Apr-09 7:28 
GeneralRe: Formatting A Rich edit control content in Editstream CallBack function Pin
ForNow29-Apr-09 8:07
ForNow29-Apr-09 8:07 
QuestionHow to enable tooltips on CWnd or CStatic derived class that is created by a regular MFC dll Pin
only_jack29-Apr-09 5:27
only_jack29-Apr-09 5:27 
AnswerRe: How to enable tooltips on CWnd or CStatic derived class that is created by a regular MFC dll Pin
Virendra Kulkarni30-Apr-09 1:04
Virendra Kulkarni30-Apr-09 1:04 
GeneralRe: How to enable tooltips on CWnd or CStatic derived class that is created by a regular MFC dll Pin
only_jack30-Apr-09 1:23
only_jack30-Apr-09 1:23 
QuestionHow can i create .jpg file programatically Pin
PankajB29-Apr-09 5:06
PankajB29-Apr-09 5:06 
QuestionRe: How can i create .jpg file programatically Pin
David Crow29-Apr-09 5:20
David Crow29-Apr-09 5:20 
AnswerRe: How can i create .jpg file programatically Pin
PankajB29-Apr-09 5:24
PankajB29-Apr-09 5:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.