Re: Share .cpp and .h along projects
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Fri, 17 Aug 2007 11:46:17 -0500
On Thu, 16 Aug 2007 16:30:28 -0500, "Ben Voigt [C++ MVP]"
<rbv@xxxxxxxxxxxxx> wrote:
Only single machine words can be used for interlocked operations, but any
larger object can be controlled in a threadsafe manner using a volatile
pointer (which is word-sized) and memory barriers.
That's nonsense, but simplify it to a uniprocessor system, which does not
have memory barriers. Heck, you could even limit it to x86 SMP systems.
Explain how you can use (say) a std::vector in a thread-safe way by "using
a volatile pointer".
Note that people who actually understand how to do multithreaded
programming and use synchronization objects such as mutexes rarely if ever
use volatile and may not even have heard of memory barriers, which they
don't need to know about in order to use synchronization objects.
<snip>
Compiler optimizations (and CPU reorders) are always defined in terms of
equivalence on a single sequence of execution.
Some of those optimizations cannot be safely applied by a compiler intended
to be useful for multithreaded programming. For some reason, that point is
not getting across.
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- References:
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- From: Doug Harrison [MVP]
- Re: Share .cpp and .h along projects
- From: Alex Blekhman
- Re: Share .cpp and .h along projects
- From: Doug Harrison [MVP]
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- From: Doug Harrison [MVP]
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- From: Doug Harrison [MVP]
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- From: Doug Harrison [MVP]
- Re: Share .cpp and .h along projects
- From: Ben Voigt [C++ MVP]
- Re: Share .cpp and .h along projects
- Prev by Date: Re: thread local variable
- Next by Date: Re: Regarding IO Completion ports
- Previous by thread: Re: Share .cpp and .h along projects
- Next by thread: Re: Share .cpp and .h along projects
- Index(es):
Relevant Pages
|