Hi. I have 2 questions.
1) Atomic as a fence. Writing to an atomic variable has release semantics, e.a. operations before the atomic assigment never move over it. Can I use atomic variables as a fence? Is there any guarantee that compiler won't optimize out the unuzed atomic variable in the following code fragment? Should I qualify it as volatile?
T* ptr; ptr = new T(...); tbb::atomic ptr_atomic; ptr_atomic = ptr; /* Past this point ptr should be pointing to the fully constructed instance of T. Right? */
2) Looks like there is a typo in the Tutorial, Chapter 8, Table 13.
x.fetch_and_store(y) does x=y, not y=x.