(Sending along some comments arising from deep within application code...)

I don't remember having seen the rules for the usage of @Volatile spelt 
out in  the X10 manual. We should.

If I (mistakenly) mark an AtomicReference as @Volatile, the x10c++ 
post-compiler gives an error:

x10c++: "./xrudra/util/XchgBuffer.h", line 134.113: 1540-0264 (S) The 
non-volatile member function 
"x10::util::concurrent::AtomicReference<xrudra::TimedWeight 
*>::getAndSet(TimedWe\
ight *)" is called for "volatile 
x10::util::concurrent::AtomicReference<xrudra::TimedWeight *>".

Not sure how to make sense of it as an X10 programmer. What am I 
supposed to do to fix this problem at the level of the X10 program? The 
wording of the error message seems to indicate that if I invoke some X10 
method defined on type T on a field datum declared as @Volatile datum:T, 
I might have a problem...?

In this case, I recognized the problem as a left-over edit. Earlier I 
was using an AtomicBoolean to guard a value of type T that was being 
read/written by two different threads, so I marked the value as @Volatile.

Then I changed the code so that the value was of type 
AtomicReference[T], and mistakenly left the @Volatile in place. It is 
not needed -- removing it was adequate to fix this problem.

Minor related note: Why is the static factory method on AtomicReference 
not called make, as in other parts of the X10 libraries? (It is called 
newAtomicReference(...).)


------------------------------------------------------------------------------
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to