Re: mutex question
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Fri, 05 May 2006 14:32:43 +0100
Slava M. Usov wrote:
"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:eVbDLI4bGHA.2404@xxxxxxxxxxxxxxxxxxxxxxx
Slava M. Usov wrote:
[...]
The original statement is exactly correct: "a variable can change
unexpectedly", so the compiler must not optimize it away. "Hardware
interaction" is just as wrong as "multithreading".
However, hardware interaction is part of volatile's remit (as I said),
whereas multithreading isn't (although it has been hijacked for this
purpose by some, since it works under certain conditions).
Please provide a quotation from the C++ standard that would support any of
these claims.
I didn't think we were talking about the C++ standard, but about the utility of the volatile keyword.
Even on those platforms (e.g. x86), volatile is still only sufficient for
single reads and writes to aligned 32 bit values, and similar examples
(such as fixing the ordering of two writes with respect to reads in
another thread).
Volatile is sufficient for any reads and writes. This is its entire and only
purpose.
Any reads and writes of what in what context? Are you talking about multithreading now (the main topic of this thread) or about the standard C++ abstract machine (which is of course single threaded, and therefore off-topic)?
Tom
.
- Follow-Ups:
- Re: mutex question
- From: Slava M. Usov
- Re: mutex question
- References:
- Re: mutex question
- From: David Jones
- Re: mutex question
- From: Tom Widmer [VC++ MVP]
- Re: mutex question
- From: Slava M. Usov
- Re: mutex question
- From: Tom Widmer [VC++ MVP]
- Re: mutex question
- From: Slava M. Usov
- Re: mutex question
- Prev by Date: Re: Any way to get RTL_USER_PROCESS_PARAMETERS at NtCreateSection entry
- Next by Date: Re: Bus Speed and HTT
- Previous by thread: Re: mutex question
- Next by thread: Re: mutex question
- Index(es):
Relevant Pages
|
Loading