Opened 10 years ago
Closed 10 years ago
#7403 closed Bugs (fixed)
lockfree support in MSVC 2012
Reported by: | Owned by: | timblechmann | |
---|---|---|---|
Milestone: | To Be Determined | Component: | lockfree |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
MSVC 2012 has atomics; it therefore allows boost.lockfree to be used with it.
Using boost.atomic on MSVC is not an option because it falls back to interlocked functions (not lock-free).
Here is a simple patch for lockfree's atomic.hpp showing the necessary changes:
- don't define BOOST_LOCKFREE_NO_HDR_ATOMIC in order to use <atomic>, not <boost/atomic.hpp>.
- remove the (cplusplus < 201103L) check because cplusplus is defined to 199711 on MSVC 2012...
There is an additional change in freelist.hpp: include <boost/cstdint.hpp> (it was being included by <boost/atomic.hpp>).
With these changes lock-free lists seem to be working fine! :) (I verified that is_lock_free() does return true.)
Feel free to adjust the patch of course; this is just to show what is required to make boost.lockfree truly lock-free on MSVC 2012. I'm available for any further questions.
Thanks for adding atomic & lockfree. :) Zouzou
Attachments (1)
Change History (2)
by , 10 years ago
Attachment: | msvclockfree.patch added |
---|
comment:1 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
applied to trunk, thanks for the patch!
Patch