From b9bd6a2167d818b1db1271a8e9d195bff2f91250 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 8 Aug 2012 18:17:49 -0700 Subject: uhd: special case boost versions for ipc namespace --- host/include/uhd/utils/atomic.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/utils/atomic.hpp b/host/include/uhd/utils/atomic.hpp index f9bc728cc..b12dde58e 100644 --- a/host/include/uhd/utils/atomic.hpp +++ b/host/include/uhd/utils/atomic.hpp @@ -23,6 +23,12 @@ #include #include +#if BOOST_VERSION >= 104800 +# define BOOST_IPC_DETAIL boost::interprocess::ipcdetail +#else +# define BOOST_IPC_DETAIL boost::interprocess::detail +#endif + namespace uhd{ //! A 32-bit integer that can be atomically accessed @@ -36,27 +42,27 @@ namespace uhd{ //! Compare with cmp, swap with newval if same, return old value UHD_INLINE boost::uint32_t cas(boost::uint32_t newval, boost::uint32_t cmp){ - return boost::interprocess::detail::atomic_cas32(&_num, newval, cmp); + return BOOST_IPC_DETAIL::atomic_cas32(&_num, newval, cmp); } //! Sets the atomic integer to a new value UHD_INLINE void write(const boost::uint32_t newval){ - boost::interprocess::detail::atomic_write32(&_num, newval); + BOOST_IPC_DETAIL::atomic_write32(&_num, newval); } //! Gets the current value of the atomic integer UHD_INLINE boost::uint32_t read(void){ - return boost::interprocess::detail::atomic_read32(&_num); + return BOOST_IPC_DETAIL::atomic_read32(&_num); } //! Increment by 1 and return the old value UHD_INLINE boost::uint32_t inc(void){ - return boost::interprocess::detail::atomic_inc32(&_num); + return BOOST_IPC_DETAIL::atomic_inc32(&_num); } //! Decrement by 1 and return the old value UHD_INLINE boost::uint32_t dec(void){ - return boost::interprocess::detail::atomic_dec32(&_num); + return BOOST_IPC_DETAIL::atomic_dec32(&_num); } private: volatile boost::uint32_t _num; -- cgit v1.2.3