On Fri, 08 Jun 2012 03:13:04 -0400, Dmitry Olshansky <dmitry.o...@gmail.com> wrote:

On 08.06.2012 8:03, Steven Schveighoffer wrote:

Yes, head stripping. I think it should be allowed. For instance, if you
wanted to read a shared double, and take the cosine of it, this should
be allowed:

auto n = cos(sharedValue);

what if it's a
auto n = cos(sharedValues[k]); //type is shared(double) right?

and somebody in the other thread is halfway through writing it?

At this point, I am not sure shared means synchronized or atomic. It just means multiple threads can see it. Perhaps you have already taken the lock that protects this variable.

My point is, the transfer of a shared type into an rvalue should strip the head-shared part of it *automatically*. Especially since it would be illegal to store such a type on the stack (and quite literally, a shared rvalue makes no sense whatsoever), we don't want to force casting everywhere.

-Steve

Reply via email to