Volatile Worthless or Not

Raf Schietekat
Total Points:
16,805
Status Points:
16,805
Black Belt
July 9, 2009 7:28 AM PDT
Rate
 
#2 Reply to #1

I think that this is about flushing out the writes somehow. so that the other thread gets to see the new Ready value, which makes at least some sense to me. But I'm also in favour of using real atomics, and you can write those without a single "volatile" (I did, anyway), because they would be redundant with the inline-assembler store instructions. Still, what prevents the optimiser from reordering even those with later code, perhaps code that waits for a value that cannot appear before the store is seen by another thread, leading to deadlock? I checked my code again, and I thought that I had at least a compiler fence at both ends to prevent just that, but not so, apparently, and I now consider that an oversight. I'm aware that language-level atomics can do other kinds of things, if only the specification were readable...

(Added) "I did, anyway": or not yet... they're still there in tbb_machine.h.



Intel Software Network Forums Statistics

8488 users have contributed to 31627 threads and 100743 posts to date.
In the past 24 hours, we have 35 new thread(s) 136 new posts(s), and 196 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member chat1983