test_mm_sc_drf_00: Testing SC-DRF non-atomic global read and write within an atomic acquire/release critical block.
More...
test_mm_sc_drf_00: Testing SC-DRF non-atomic global read and write within an atomic acquire/release critical block.
Modified non-atomic memory within the atomic acquire (load) and release (store) block, must be visible for all threads according to memory model (MM) Sequentially Consistent (SC) being data-race-free (DRF).
See Herb Sutter's 2013-12-23 slides p19, first box "It must be impossible for the assertion to fail – wouldn’t be SC.".
This test's threads utilize a spin-lock, waiting for their turn. Such busy cycles were chosen to simplify the test and are not recommended as they expose poor performance on a high thread-count and hence long 'working thread pipe'.
See 'test_mm_sc_drf_01' implementing same test using mutex-lock and condition wait.
- Examples
- test_mm_sc_drf_00.cpp.
Definition at line 60 of file test_mm_sc_drf_00.cpp.