There are two threads (t1 and t2) pinned to two different cores. They both have a shared variable which is a raw pointer to some class type. t1 only reads the pointer and t2 reads/writes the pointer. Should I declare the pointer as just volatile or atomic or both?
When t2 updates this pointer, it is fine if t1 reads the old one or new one but it should not read any intermediate value as it will cause seg fault.