Subject: [Boost-bugs] [Boost C++ Libraries] #7403: lockfree support in MSVC 2012
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-21 18:28:21
#7403: lockfree support in MSVC 2012
------------------------------------------+---------------------------------
Reporter: Zouzou <internet@â¦> | Owner: timblechmann
Type: Bugs | Status: new
Milestone: To Be Determined | Component: lockfree
Version: Boost 1.52.0 | Severity: Problem
Keywords: |
------------------------------------------+---------------------------------
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
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7403> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC