Click here to Skip to main content
15,894,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDraw a cube Pin
gentleguy13-Jun-07 5:18
gentleguy13-Jun-07 5:18 
AnswerRe: Draw a cube Pin
Dustin Henry13-Jun-07 6:51
Dustin Henry13-Jun-07 6:51 
QuestionOnMouseMove HELP Please Pin
Charlie Curtis13-Jun-07 3:39
Charlie Curtis13-Jun-07 3:39 
AnswerRe: OnMouseMove HELP Please [modified] Pin
Mark Salsbery13-Jun-07 7:19
Mark Salsbery13-Jun-07 7:19 
QuestionC++ Thread Memory States/References Pin
Eshazear13-Jun-07 3:36
Eshazear13-Jun-07 3:36 
AnswerRe: C++ Thread Memory States/References Pin
James R. Twine13-Jun-07 3:46
James R. Twine13-Jun-07 3:46 
GeneralRe: C++ Thread Memory States/References Pin
Eshazear13-Jun-07 4:13
Eshazear13-Jun-07 4:13 
GeneralRe: C++ Thread Memory States/References Pin
Roger Stoltz13-Jun-07 4:35
Roger Stoltz13-Jun-07 4:35 
The compiler will optimize and not read the actual value of a variable if the value is not changed within the scope (e.g. a while-loop). This is why the volatile keyword is essential in this case.

In your implementation you will also get corrupted data. You won't see the effect of it since you don't use the parent->m_Th1Value variable. This should be guarded by a critical section.


Eshazear wrote:
The documentation states : "The following example declares a volatile integer nVint whose value can be modified by external processes.... "
Does this imply that without the volatile keyword, that memory would otherwise be guarded against other processes trying to attempting to modify it?


No.
The volatile keyword informs the compiler that the variable may change in the background and thus the actual value of the variable has to be read and cannot be optimized.
Protecting the data written to by different processes is done by using data synchronization objects such as critical sections and mutexes.


Eshazear wrote:
would you be able to point me in the direction of some good reading on this topic


Absolutely, the best place to start I've found on the net is here[^].


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown

GeneralMultithreaded aproaches Pin
Eshazear13-Jun-07 4:45
Eshazear13-Jun-07 4:45 
QuestionVolatile Array allocation on the heap? Pin
Eshazear14-Jun-07 1:33
Eshazear14-Jun-07 1:33 
QuestionNeed Help.. Pin
rajeevktripathi13-Jun-07 3:12
rajeevktripathi13-Jun-07 3:12 
QuestionRe: Need Help.. Pin
Hamid_RT13-Jun-07 3:20
Hamid_RT13-Jun-07 3:20 
AnswerRe: Need Help.. Pin
Hamid_RT13-Jun-07 3:24
Hamid_RT13-Jun-07 3:24 
GeneralRe: Need Help.. Pin
rajeevktripathi13-Jun-07 19:23
rajeevktripathi13-Jun-07 19:23 
QuestionRe: Need Help.. Pin
Hamid_RT13-Jun-07 20:57
Hamid_RT13-Jun-07 20:57 
GeneralRe: Need Help.. Pin
rajeevktripathi14-Jun-07 1:26
rajeevktripathi14-Jun-07 1:26 
QuestionNeed Help.... Pin
rajeevktripathi13-Jun-07 3:11
rajeevktripathi13-Jun-07 3:11 
AnswerRe: Need Help.... Pin
James R. Twine13-Jun-07 3:25
James R. Twine13-Jun-07 3:25 
GeneralRe: Need Help.... Pin
rajeevktripathi13-Jun-07 19:21
rajeevktripathi13-Jun-07 19:21 
AnswerRe: Need Help.... Pin
Programm3r13-Jun-07 4:18
Programm3r13-Jun-07 4:18 
QuestionShowing/hiding Groups of controls Pin
softwaremonkey13-Jun-07 2:47
softwaremonkey13-Jun-07 2:47 
AnswerRe: Showing/hiding Groups of controls Pin
Hamid_RT13-Jun-07 3:17
Hamid_RT13-Jun-07 3:17 
AnswerRe: Showing/hiding Groups of controls Pin
James R. Twine13-Jun-07 3:19
James R. Twine13-Jun-07 3:19 
GeneralRe: Showing/hiding Groups of controls Pin
softwaremonkey13-Jun-07 4:48
softwaremonkey13-Jun-07 4:48 
AnswerRe: Showing/hiding Groups of controls Pin
David Crow13-Jun-07 3:33
David Crow13-Jun-07 3:33 

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.