- atomic double-width problem... - 3 Updates
- Looking for some example of stellar code for educational purpose. Any recommendations? - 19 Updates
- c++ learning... - 2 Updates
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 20 01:24AM -0700 I have always used my custom asm for this, but I noticed a while ago that C++11 can use Double-Width Compare-and-Swap (DWCAS) via a struct the size of two pointers for atomic operations. Out of interest, I have constructed the following program that works on MSVC 14.0.25424.00 Update 3. However, on GCC 6.3.0, I am getting the following errors: ____________________________ ||=== Build: Debug in ct_experiment (compiler: GNU GCC Compiler) ===| obj\Debug\main.o||In function `std::atomic<ct_dwcas>::is_lock_free() const':| C:\msys64\mingw64\include\c++\6.3.0\atomic|212|undefined reference to `__atomic_is_lock_free'| obj\Debug\main.o||In function `std::atomic<ct_dwcas>::load(std::memory_order) const':| C:\msys64\mingw64\include\c++\6.3.0\atomic|235|undefined reference to `__atomic_load_16'| obj\Debug\main.o||In function `std::atomic<ct_dwcas>::compare_exchange_weak(ct_dwcas&, ct_dwcas, std::memory_order, std::memory_order)':| C:\msys64\mingw64\include\c++\6.3.0\atomic|268|undefined reference to `__atomic_compare_exchange_16'| ||error: ld returned 1 exit status| ||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| ____________________________ Here is the code: ____________________________ #if defined (_MSC_VER) # define _ENABLE_ATOMIC_ALIGNMENT_FIX // for dwcas
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment