Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHaving different value for a global variable per thread. Pin
Code-o-mat12-Mar-10 1:20
Code-o-mat12-Mar-10 1:20 
AnswerRe: Having different value for a global variable per thread. Pin
sunlin712-Mar-10 1:37
sunlin712-Mar-10 1:37 
GeneralRe: Having different value for a global variable per thread. Pin
Code-o-mat12-Mar-10 1:44
Code-o-mat12-Mar-10 1:44 
AnswerRe: Having different value for a global variable per thread. Pin
Jonathan Davies12-Mar-10 1:38
Jonathan Davies12-Mar-10 1:38 
GeneralRe: Having different value for a global variable per thread. Pin
Code-o-mat12-Mar-10 1:44
Code-o-mat12-Mar-10 1:44 
AnswerRe: Having different value for a global variable per thread. Pin
Chris Losinger12-Mar-10 3:25
professionalChris Losinger12-Mar-10 3:25 
GeneralRe: Having different value for a global variable per thread. Pin
Code-o-mat12-Mar-10 3:30
Code-o-mat12-Mar-10 3:30 
AnswerRe: Having different value for a global variable per thread. Pin
Russell'12-Mar-10 8:48
Russell'12-Mar-10 8:48 
Coorect me if I wrong my interpretation: It looks that you have only to pass an input parameter of the threads.
Well, in this case I think that the usual way is not to store the variable into the global memory but pass a pointer to the thread when it is starting. this pointer points to a struct where the new thread can find all the initial values. You have only to wait that the new thread read all the parameters and store they into his local memory, then the caller can continue the flow destroing the objects.

If that parameters can be changed from the main thread during the execution you can then pass to every single thread a set of pointers to these variables. Of course you'll need to allocate an array of variable (one per each thread).

Russell

GeneralRe: Having different value for a global variable per thread. Pin
Code-o-mat12-Mar-10 10:12
Code-o-mat12-Mar-10 10:12 
QuestionHow to find source of buffer overflow Pin
WernerP11-Mar-10 23:44
WernerP11-Mar-10 23:44 
AnswerRe: How to find source of buffer overflow Pin
Eugen Podsypalnikov12-Mar-10 0:08
Eugen Podsypalnikov12-Mar-10 0:08 
AnswerRe: How to find source of buffer overflow Pin
Eugen Podsypalnikov12-Mar-10 0:24
Eugen Podsypalnikov12-Mar-10 0:24 
GeneralRe: How to find source of buffer overflow Pin
WernerP12-Mar-10 2:19
WernerP12-Mar-10 2:19 
GeneralRe: How to find source of buffer overflow Pin
Eugen Podsypalnikov12-Mar-10 2:44
Eugen Podsypalnikov12-Mar-10 2:44 
AnswerRe: How to find source of buffer overflow Pin
CPallini12-Mar-10 0:35
mveCPallini12-Mar-10 0:35 
AnswerRe: How to find source of buffer overflow Pin
Adam Roderick J12-Mar-10 0:53
Adam Roderick J12-Mar-10 0:53 
GeneralRe: How to find source of buffer overflow Pin
WernerP12-Mar-10 2:21
WernerP12-Mar-10 2:21 
Questiongiving url to .ini file Pin
jannathali11-Mar-10 23:25
jannathali11-Mar-10 23:25 
AnswerRe: giving url to .ini file Pin
KarstenK12-Mar-10 0:08
mveKarstenK12-Mar-10 0:08 
GeneralRe: giving url to .ini file Pin
jannathali12-Mar-10 1:07
jannathali12-Mar-10 1:07 
AnswerRe: giving url to .ini file Pin
Eugen Podsypalnikov12-Mar-10 2:02
Eugen Podsypalnikov12-Mar-10 2:02 
AnswerRe: giving url to .ini file Pin
David Crow12-Mar-10 3:10
David Crow12-Mar-10 3:10 
QuestionCreate a gui for linux. Pin
krish_kumar11-Mar-10 21:09
krish_kumar11-Mar-10 21:09 
AnswerRe: Create a gui for linux. Pin
KingsGambit11-Mar-10 21:13
KingsGambit11-Mar-10 21:13 
GeneralRe: Create a gui for linux. Pin
krish_kumar11-Mar-10 21:35
krish_kumar11-Mar-10 21:35 

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.