Re: mutex question



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
.



Relevant Pages

  • Re: mutex question
    ... utility of the volatile keyword. ... You disputed somebody else's statements "about the utility of the volatile ... standard cannot be demonstrated if the standard is not cited. ... Well, under the POSIX standard, volatile is useless for multithreading. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Is C99 the final C? (some suggestions)
    ... The C standard specifies what is UB and what's not. ... If you have multithreading, they you have to lock and unlock ... > your heap, or use other strategies to make sure one thread isn't in the middle ... Having a different set of condoned operators at each programming ...
    (comp.lang.c)
  • Re: assembly in future C standard
    ... > multithreading as there are too much different possibilities how naked ... Keep in mind that the POSIX pthreads standard has ... Semaphore handling isn't OS-specific or even machine-specific. ... C does not even know a bit of concurrent running programs, ...
    (comp.std.c)
  • Re: assembly in future C standard
    ... > multithreading as there are too much different possibilities how naked ... Keep in mind that the POSIX pthreads standard has ... Because if send is blocking, there's no need for buffering; ...
    (comp.std.c)
  • Re: Boolean Buyers Beware ... AIX compiler bug --- PMR 26241,756
    ... IBM identified a source work-around, and claimed the problem was our ... I don't think the C++ standard has a word to say about threads. ... C++ doesn't specify anything here, and still one needs multithreading. ...
    (comp.programming.threads)

Loading