Added a fix for compilation with Boost v1.48 (not tested)
authorDavid Bucciarelli <dade@ngi.it>
Thu Mar 08 15:42:12 2012 +0100 (14 months ago)
changeset 1019d0f2938aa2ee
parent 1018 cb3709070825
child 1020 881e4861aad6
Added a fix for compilation with Boost v1.48 (not tested)
include/luxrays/utils/core/atomic.h
     1.1 --- a/include/luxrays/utils/core/atomic.h	Wed Mar 07 12:10:58 2012 +0100
     1.2 +++ b/include/luxrays/utils/core/atomic.h	Thu Mar 08 15:42:12 2012 +0100
     1.3 @@ -23,6 +23,7 @@
     1.4  #ifndef _LUXRAYS_ATOMIC_H
     1.5  #define _LUXRAYS_ATOMIC_H
     1.6  
     1.7 +#include <boost/version.hpp>
     1.8  #include <boost/interprocess/detail/atomic.hpp>
     1.9  
    1.10  namespace luxrays {
    1.11 @@ -43,7 +44,13 @@
    1.12  
    1.13  		oldVal.f = *val;
    1.14  		newVal.f = oldVal.f + delta;
    1.15 -	} while (boost::interprocess::detail::atomic_cas32(((boost::uint32_t *)val), newVal.i, oldVal.i) != oldVal.i);
    1.16 +	} while (
    1.17 +#if (BOOST_VERSION < 104800)
    1.18 +		boost::interprocess::detail::atomic_cas32(
    1.19 +#else
    1.20 +		boost::interprocess::ipcdetail::atomic_cas32(
    1.21 +#endif
    1.22 +			((boost::uint32_t *)val), newVal.i, oldVal.i) != oldVal.i);
    1.23  }
    1.24  
    1.25  inline void AtomicAdd(unsigned int *val, const unsigned int delta) {
    1.26 @@ -55,14 +62,30 @@
    1.27           __asm__ __volatile__("pause\n");
    1.28        #endif
    1.29        newVal = *val + delta;
    1.30 -   } while (boost::interprocess::detail::atomic_cas32(((boost::uint32_t*)val), newVal, *val) != *val);
    1.31 +   } while (
    1.32 +#if (BOOST_VERSION < 104800)
    1.33 +		boost::interprocess::detail::atomic_cas32(
    1.34  #else
    1.35 +		boost::interprocess::ipcdetail::atomic_cas32(
    1.36 +#endif
    1.37 +		   ((boost::uint32_t*)val), newVal, *val) != *val);
    1.38 +#else
    1.39 +
    1.40 +#if (BOOST_VERSION < 104800)
    1.41  	boost::interprocess::detail::atomic_add32(((boost::uint32_t *)val), (boost::uint32_t)delta);
    1.42 +#else
    1.43 +	boost::interprocess::ipcdetail::atomic_add32(((boost::uint32_t *)val), (boost::uint32_t)delta);
    1.44 +#endif
    1.45 +
    1.46  #endif
    1.47  }
    1.48  
    1.49  inline void AtomicInc(unsigned int *val) {
    1.50 +#if (BOOST_VERSION < 104800)
    1.51  	boost::interprocess::detail::atomic_inc32(((boost::uint32_t *)val));
    1.52 +#else
    1.53 +	boost::interprocess::ipcdetail::atomic_inc32(((boost::uint32_t *)val));
    1.54 +#endif
    1.55  }
    1.56  
    1.57  }