Re: mutex question



"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:uAKjiq3cGHA.4428@xxxxxxxxxxxxxxxxxxxxxxx
Slava M. Usov wrote:

[...]

Reads and writes did happen; your "corrupt" involves an ad hoc
assumption -- the atomicity of reads and writes.

It's neither ad hoc nor an assumption, but a requirement of "sufficient".

Atomicity is a requirement for reading or writing? This is not even funny.

[...]

Semantic arguments about the exact meaning of "useful" and "useless"
aside, what is the use of volatile in multithreading?

The 'volatile' keyword is useful with or without multithreading. For a
particular example involving multithreading, read the first message you
responded to in this thread.

S


.



Relevant Pages

  • Re: mutex question
    ... Atomicity is a requirement for reading or writing? ... The 'volatile' keyword is useful with or without multithreading. ... Nor was it even strictly correct due to its use of printf in a thread created by CreateThread. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Is "volatile sig_atomic_t" redundant?
    ... Dave Vandervies wrote: ... >>which kind of atomicity he had in mind. ... require that declaring an object as just 'sig_atomic_t' (no 'volatile') ...
    (comp.lang.c)
  • Re: mutex question
    ... The 'volatile' keyword is useful with or without multithreading. ... and the very idea of synchronization is to make sure shared ... modifier may be quite usefull for multithreaded program. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Volatile + multithreading
    ... The volatile keyword has little use in multithreaded programming. ... > field or global seems to have no impact because it seems the compiler will ... operations as "special" and suppress optimizations around them. ... > majority of the multithreading issues that could have resulted from ...
    (microsoft.public.vc.language)
  • Re: Thread safety and atomic assignment (again)
    ... By making the internal field volatile, you have made your class data- ... Are the following code snippets thread safe and why? ... Atomicity and volatileness are two different issues: ... guarantee both visibility and atomicity; ...
    (comp.lang.java.programmer)

Loading