Re: mutex question
- From: "Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx>
- Date: Tue, 16 May 2006 11:00:29 +0100
Slava M. Usov wrote:
"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:uASK2TBeGHA.1856@xxxxxxxxxxxxxxxxxxxxxxx
Slava M. Usov wrote:
"Tom Widmer" <tom_usenet@xxxxxxxxxxx> wrote in message
news:%2333sd$AdGHA.4224@xxxxxxxxxxxxxxxxxxxxxxx
Yes. What's your definition of "sufficient" in the context of this
thread?
Something is sufficient for externally observable reads and writes when
externally observable reads and writes happen. Atomicity is completely
and
entirely irrelevant here.
We weren't talking about 'sufficient for externally observable reads and
writes'. Go back to the first usage of the term in this thread.
When I used this term, I knew what I was talking about. Do not attribute
your confusion to me.
Do you agree or disagree with my usage of sufficient, which has nothing much to do with your 'sufficient for externally observable reads and writes', by which I think you mean "triggers a memory read or write", without placing much in the way of semantics on those reads and writes.
My usage was:
'On the contrary, it is *not* necessary nor is it sufficient to use volatile on variables shared between threads.'
Here, the term 'sufficient' has some semantics attached to it with regard to the values of those shared variables.
That program didn't do anything useful.
Ignoratio elenchi.
Indeed - the example wasn't relevant to what you wanted it to prove,
though I accept that you might be able to modify it so that it is.
It was not my example and I did not try to prove anything. You're trying to
prove that 'volatile' is not what the language standard says it is, and the
example is very relevant because it is incompatible with your claims.
The program is non-standard - any multithreaded program is outside the C++ standard. What's the C++ standard definition of volatile got to do with its utility in multithreaded programming? You have to go outside the standard to individual compiler and platform behaviour, where (if you are lucky), the documentation details the multithreaded memory model in operation. For MS, this stuff is generally spread through the documentation of Interlocked*, _*Barrier and the synchronization primitives, though in many cases it leaves you to try to reason about the semantics based on its semantics in a single threaded program, or doesn't define them at all.
Introducing write and read barriers hardly makes things more efficient.
You're right in this case - efficiency is probably unaffected.
This is all you really need to say.
Indeed, I can admit when I'm wrong on a point. I hope this thread is still presenting some light on the issue to anyone still reading it.
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
- 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
- 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
- From: Tom Widmer
- 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: Console output
- Next by Date: Re: mutex question
- Previous by thread: Re: mutex question
- Next by thread: Re: mutex question
- Index(es):
Relevant Pages
|