C++11 on modern Intel: am I crazy or are non-atomic aligned 64-bit load/store actually atomic?
问题 Can I base a mission-critical application on the results of this test, that 100 threads reading a pointer set a billion times by a main thread never see a tear? Any other potential problems doing this besides tearing? Here's a stand-alone demo that compiles with g++ -g tear.cxx -o tear -pthread . #include <atomic> #include <thread> #include <vector> using namespace std; void* pvTearTest; atomic<int> iTears( 0 ); void TearTest( void ) { while (1) { void* pv = (void*) pvTearTest; intptr_t i =