summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-08-08 18:17:49 -0700
committerJosh Blum <josh@joshknows.com>2012-08-08 18:17:49 -0700
commitb9bd6a2167d818b1db1271a8e9d195bff2f91250 (patch)
tree95d23531fdae62c1681a14c1c3d5316d86ca3797
parent072c88af872fd9d2fc8cbf7b1c1a0ab31cc62c86 (diff)
downloaduhd-b9bd6a2167d818b1db1271a8e9d195bff2f91250.tar.gz
uhd-b9bd6a2167d818b1db1271a8e9d195bff2f91250.tar.bz2
uhd-b9bd6a2167d818b1db1271a8e9d195bff2f91250.zip
uhd: special case boost versions for ipc namespace
-rw-r--r--host/include/uhd/utils/atomic.hpp16
1 files changed, 11 insertions, 5 deletions
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 <boost/thread/thread.hpp>
#include <boost/interprocess/detail/atomic.hpp>
+#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;