Re: MSDN volatile sample
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Sun, 30 Dec 2007 07:31:25 -0800
Because Sleep() is an imported (from system DLL) function, the compiler
cannot make any assumption about whether a global variable will keep its
state across the call. Thus it won't assume that the variable won't be
changed.
"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0D4718E0-5DCB-4762-8D0D-B74BD1442FAF@xxxxxxxxxxxxxxxx
Hi Alexander,
I throught it is not the 1st time you mentioned Sleep(0) will prevent
compiler to optimize the code. :-)
Do you have any in-depth analysis about how Sleep(0)'s internal mechanism
prevents compiler to optimize read operation? I think some people will be
interested if you could provide some internal perpective analysis beyond
the
conclusion.
Maybe the straight forward way is to post some assembly code. :-)
regards and have a nice day,
George
.
- References:
- Re: MSDN volatile sample
- From: Norbert Unterberg
- Re: MSDN volatile sample
- From: Norbert Unterberg
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: ajk
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: Alex Blekhman
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: Alex Blekhman
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: Alex Blekhman
- Re: MSDN volatile sample
- From: Alexander Grigoriev
- Re: MSDN volatile sample
- Prev by Date: Re: MSDN volatile sample
- Next by Date: Re: MSDN volatile sample
- Previous by thread: Re: MSDN volatile sample
- Next by thread: Re: MSDN volatile sample
- Index(es):
Relevant Pages
|