Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-03-15 19:24:29


At 04:28 PM 3/15/2001, williamkempf_at_[hidden] wrote:

>> Am I missing something?
>
>Just a small detail. A classic example is the "Double-Checked
>Locking Optimization" pattern. On MP (multiple processor) machines
>the machines architecture does some optimizations that can result in
>this pattern not working. In addition to language constructs such as
>volatile you need to use a platform specific "memory barrier" to
>insure the CPU(s) don't optimize the code in such a way as to cause
>incorrect behavior in this pattern. The atomic_t type built on using
>a mutex may be subject to this same error (this goes beyond my
>expertise on the subject). There was a recent thread on this subject
>on the Usenet.

So if I understand you correctly, on some platforms the hoops you have to
jump through are multi-step sequences of platform specific features. Very
tricky, but doesn't the logic still hold? You can make it work as long as
you follow the platform's rules.

>The point is, however, these issues can all be addressed in a
>platform specific manner with out the need for a change to the
>interface of atomic_t.

Yes, understood.

Just out of curiosity, what platforms are we talking about? Are they
exotic ones where users expect to have to do a lot of hand tailoring?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk