Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-11-12 10:37:21


Neal Becker wrote:
> Perhaps of some interest:
>
> http://www.hpl.hp.com/research/linux/atomic_ops/

You might also look at:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2047.html

Hans Boehm's proposal seems to build upon this library you
were pointing at. (Not surprisingly, since he is the author of it.)

I am currently trying to prototype something along his proposal, to
see how far I can get.

Until now I have found some loopholes I am trying to figure out.

E.g.:

atomic<int> i1;
atomic<int> i2;

i1 = 42; // assignment is atomic
i1 = i2; // assignment is not atomic !

--> should atomics be allowed to be copyable?

I would say: yes and no. I would expect that the value can be
transfered, but it should be semantically equivalent to:

int t;
t = i1;
i2 = t;

The current proposal as far as I can see does not address this
issue. It allows for a bitwise copy by the compiler.

Or :

struct a4 {
     char c[4];
};

atomic<a4> a;

Shall this be possible, if a4 is POD and has same alignment and
size of a type that can be manipulated atomically?
If yes, how can it be implemented?

If you like we can discuss this further.

Roland


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