Click here to Skip to main content
15,908,842 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:17
George_George28-Dec-07 18:17 
GeneralRe: Yes. [modified] Pin
JudyL_MD28-Dec-07 20:01
JudyL_MD28-Dec-07 20:01 
GeneralRe: Yes. Pin
George_George28-Dec-07 23:01
George_George28-Dec-07 23:01 
GeneralRe: Yes. Pin
JudyL_MD29-Dec-07 4:40
JudyL_MD29-Dec-07 4:40 
GeneralRe: Yes. Pin
George_George29-Dec-07 19:39
George_George29-Dec-07 19:39 
GeneralRe: Yes. Pin
JudyL_MD30-Dec-07 4:37
JudyL_MD30-Dec-07 4:37 
GeneralRe: Yes. Pin
George_George31-Dec-07 4:01
George_George31-Dec-07 4:01 
GeneralRe: Yes. Pin
JudyL_MD31-Dec-07 4:30
JudyL_MD31-Dec-07 4:30 
Depends on what the compiler thinks the value of Sentinel is when it encounters it, while doing its optimizing run. If it thinks it is true, it would optimize so that it deadlocks. If it thinks it is false, it would optimize so that it allows multiple access. Without knowing the details of how the optimizer works, it could be either one. It may see the value as true if it does all its global variable initializations at the start of its processing and doesn't change them. It may see the value as false if it notes the assignment to false (and only false) in the second thread during its first pass and then does the optimizations in its second pass. It all depends on how the compiler is implemented. I admit the "optimize away" case is reaching a bit Smile | :) but you never know. Take a look at the assembly language generated by an optimizing compiler sometime; it does some mighty weird stuff sometimes. I wouldn't put anything past it.

Judy
GeneralRe: Yes. Pin
George_George31-Dec-07 5:17
George_George31-Dec-07 5:17 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:19
George_George28-Dec-07 18:19 
GeneralRe: Yes. Pin
David Crow28-Dec-07 4:58
David Crow28-Dec-07 4:58 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:17
George_George28-Dec-07 18:17 
GeneralRe: MSDN volatile sample Pin
peterchen28-Dec-07 2:47
peterchen28-Dec-07 2:47 
GeneralRe: MSDN volatile sample Pin
George_George28-Dec-07 3:20
George_George28-Dec-07 3:20 
GeneralRe: MSDN volatile sample [modified] Pin
peterchen28-Dec-07 4:21
peterchen28-Dec-07 4:21 
GeneralRe: MSDN volatile sample Pin
Maxwell Chen28-Dec-07 4:31
Maxwell Chen28-Dec-07 4:31 
GeneralRe: MSDN volatile sample Pin
peterchen28-Dec-07 4:32
peterchen28-Dec-07 4:32 
GeneralRe: MSDN volatile sample Pin
Maxwell Chen28-Dec-07 4:34
Maxwell Chen28-Dec-07 4:34 
GeneralRe: MSDN volatile sample Pin
George_George28-Dec-07 18:37
George_George28-Dec-07 18:37 
GeneralRe: MSDN volatile sample Pin
peterchen29-Dec-07 10:51
peterchen29-Dec-07 10:51 
GeneralRe: MSDN volatile sample Pin
George_George29-Dec-07 19:51
George_George29-Dec-07 19:51 
GeneralRe: MSDN volatile sample Pin
peterchen30-Dec-07 0:22
peterchen30-Dec-07 0:22 
GeneralRe: MSDN volatile sample Pin
George_George30-Dec-07 0:39
George_George30-Dec-07 0:39 
GeneralRe: MSDN volatile sample Pin
peterchen30-Dec-07 2:19
peterchen30-Dec-07 2:19 
GeneralRe: MSDN volatile sample Pin
George_George30-Dec-07 2:48
George_George30-Dec-07 2:48 

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.