diff options
Diffstat (limited to 'boost/interprocess/detail')
-rw-r--r-- | boost/interprocess/detail/atomic.hpp | 54 | ||||
-rw-r--r-- | boost/interprocess/detail/in_place_interface.hpp | 2 | ||||
-rw-r--r-- | boost/interprocess/detail/intermodule_singleton_common.hpp | 2 | ||||
-rw-r--r-- | boost/interprocess/detail/managed_open_or_create_impl.hpp | 4 | ||||
-rw-r--r-- | boost/interprocess/detail/named_proxy.hpp | 2 | ||||
-rw-r--r-- | boost/interprocess/detail/os_thread_functions.hpp | 15 | ||||
-rw-r--r-- | boost/interprocess/detail/segment_manager_helper.hpp | 10 | ||||
-rw-r--r-- | boost/interprocess/detail/transform_iterator.hpp | 164 | ||||
-rw-r--r-- | boost/interprocess/detail/variadic_templates_tools.hpp | 8 | ||||
-rw-r--r-- | boost/interprocess/detail/win32_api.hpp | 2 | ||||
-rw-r--r-- | boost/interprocess/detail/workaround.hpp | 2 |
11 files changed, 89 insertions, 176 deletions
diff --git a/boost/interprocess/detail/atomic.hpp b/boost/interprocess/detail/atomic.hpp index e32f056c3d..041076cd65 100644 --- a/boost/interprocess/detail/atomic.hpp +++ b/boost/interprocess/detail/atomic.hpp @@ -570,6 +570,60 @@ inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) } //namespace ipcdetail{ } //namespace interprocess{ } //namespace boost{ +#elif defined(__VXWORKS__) + +#include <vxAtomicLib.h> +// VxWorks atomic32_t is not volatile, for some unknown reason +#define vx_atomic_cast(_i) (reinterpret_cast< ::atomic32_t *>( const_cast<boost::uint32_t *>(_i))) + +namespace boost { +namespace interprocess { +namespace ipcdetail{ + +//! Atomically add 'val' to an boost::uint32_t +//! "mem": pointer to the object +//! "val": amount to add +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_add32 + (volatile boost::uint32_t *mem, boost::uint32_t val) +{ return ::vxAtomic32Add( vx_atomic_cast(mem), val); } + +//! Atomically increment an apr_uint32_t by 1 +//! "mem": pointer to the object +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem) +{ return ::vxAtomic32Inc( vx_atomic_cast(mem) ); } + +//! Atomically decrement an boost::uint32_t by 1 +//! "mem": pointer to the atomic value +//! Returns the old value pointed to by mem +inline boost::uint32_t atomic_dec32(volatile boost::uint32_t *mem) +{ return ::vxAtomic32Dec( vx_atomic_cast(mem) ); } + +//! Atomically read an boost::uint32_t from memory +inline boost::uint32_t atomic_read32(volatile boost::uint32_t *mem) +{ return ::vxAtomic32Get( vx_atomic_cast(mem) ); } + +//! Compare an boost::uint32_t's value with "cmp". +//! If they are the same swap the value with "with" +//! "mem": pointer to the value +//! "with" what to swap it with +//! "cmp": the value to compare it to +//! Returns the old value of *mem +inline boost::uint32_t atomic_cas32 + (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) +{ return ::vxAtomic32Cas( vx_atomic_cast(mem), cmp, with); } + +//! Atomically set an boost::uint32_t in memory +//! "mem": pointer to the object +//! "param": val value that the object will assume +inline void atomic_write32(volatile boost::uint32_t *mem, boost::uint32_t val) +{ ::vxAtomic32Set( vx_atomic_cast(mem), val); } + + +} //namespace ipcdetail{ +} //namespace interprocess{ +} //namespace boost{ #else diff --git a/boost/interprocess/detail/in_place_interface.hpp b/boost/interprocess/detail/in_place_interface.hpp index 013691ad78..367f9dca3d 100644 --- a/boost/interprocess/detail/in_place_interface.hpp +++ b/boost/interprocess/detail/in_place_interface.hpp @@ -51,7 +51,7 @@ template<class T> struct placement_destroy : public in_place_interface { placement_destroy() - : in_place_interface(::boost::container::container_detail::alignment_of<T>::value, sizeof(T), typeid(T).name()) + : in_place_interface(::boost::container::dtl::alignment_of<T>::value, sizeof(T), typeid(T).name()) {} virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed) diff --git a/boost/interprocess/detail/intermodule_singleton_common.hpp b/boost/interprocess/detail/intermodule_singleton_common.hpp index c890c326bc..392db1f86b 100644 --- a/boost/interprocess/detail/intermodule_singleton_common.hpp +++ b/boost/interprocess/detail/intermodule_singleton_common.hpp @@ -290,7 +290,7 @@ class intermodule_singleton_common static union mem_holder_t { unsigned char map_mem [sizeof(ThreadSafeGlobalMap)]; - ::boost::container::container_detail::max_align_t aligner; + ::boost::container::dtl::max_align_t aligner; } mem_holder; }; diff --git a/boost/interprocess/detail/managed_open_or_create_impl.hpp b/boost/interprocess/detail/managed_open_or_create_impl.hpp index 9351f391f9..b47c310f48 100644 --- a/boost/interprocess/detail/managed_open_or_create_impl.hpp +++ b/boost/interprocess/detail/managed_open_or_create_impl.hpp @@ -115,8 +115,8 @@ class managed_open_or_create_impl ct_rounded_size < sizeof(boost::uint32_t) , MemAlignment ? (MemAlignment) : - (::boost::container::container_detail::alignment_of - < ::boost::container::container_detail::max_align_t >::value) + (::boost::container::dtl::alignment_of + < ::boost::container::dtl::max_align_t >::value) >::value; managed_open_or_create_impl() diff --git a/boost/interprocess/detail/named_proxy.hpp b/boost/interprocess/detail/named_proxy.hpp index 4bec375b67..f3eb61d398 100644 --- a/boost/interprocess/detail/named_proxy.hpp +++ b/boost/interprocess/detail/named_proxy.hpp @@ -274,7 +274,7 @@ class named_proxy T *operator()( BOOST_MOVE_UREF##N ) const\ {\ typedef typename if_c<is_iterator \ - , CtorIt##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \ + , CtorIt##N <T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \ , CtorArg##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \ >::type ctor_obj_t;\ ctor_obj_t ctor_obj = ctor_obj_t( BOOST_MOVE_FWD##N );\ diff --git a/boost/interprocess/detail/os_thread_functions.hpp b/boost/interprocess/detail/os_thread_functions.hpp index 8a0a47cc27..1c48ecf58b 100644 --- a/boost/interprocess/detail/os_thread_functions.hpp +++ b/boost/interprocess/detail/os_thread_functions.hpp @@ -52,6 +52,9 @@ # include <sys/param.h> # include <sys/sysctl.h> # endif +#if defined(__VXWORKS__) +#include <vxCpuLib.h> +#endif //According to the article "C/C++ tip: How to measure elapsed real time for benchmarking" //Check MacOs first as macOS 10.12 SDK defines both CLOCK_MONOTONIC and //CLOCK_MONOTONIC_RAW and no clock_gettime. @@ -480,6 +483,18 @@ inline unsigned int get_num_cores() else{ return static_cast<unsigned int>(num_cores); } + #elif defined(__VXWORKS__) + cpuset_t set = ::vxCpuEnabledGet(); + #ifdef __DCC__ + int i; + for( i = 0; set; ++i) + { + set &= set -1; + } + return(i); + #else + return (__builtin_popcount(set) ); + #endif #endif } diff --git a/boost/interprocess/detail/segment_manager_helper.hpp b/boost/interprocess/detail/segment_manager_helper.hpp index cfa4bd2ba7..96ccf227fe 100644 --- a/boost/interprocess/detail/segment_manager_helper.hpp +++ b/boost/interprocess/detail/segment_manager_helper.hpp @@ -117,7 +117,7 @@ struct block_header { return get_rounded_size ( size_type(sizeof(Header)) - , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)) + , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)) + total_size(); } @@ -169,7 +169,7 @@ struct block_header template<class T> static block_header<size_type> *block_header_from_value(T *value) - { return block_header_from_value(value, sizeof(T), ::boost::container::container_detail::alignment_of<T>::value); } + { return block_header_from_value(value, sizeof(T), ::boost::container::dtl::alignment_of<T>::value); } static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn) { @@ -190,7 +190,7 @@ struct block_header block_header<size_type> * hdr = reinterpret_cast<block_header<size_type>*>(reinterpret_cast<char*>(header) + get_rounded_size( size_type(sizeof(Header)) - , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))); + , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))); //Some sanity checks return hdr; } @@ -201,7 +201,7 @@ struct block_header Header * hdr = reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) - get_rounded_size( size_type(sizeof(Header)) - , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))); + , size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))); //Some sanity checks return hdr; } @@ -275,7 +275,7 @@ struct intrusive_value_type_impl intrusive_value_type_impl(){} - enum { BlockHdrAlignment = ::boost::container::container_detail::alignment_of<block_header<size_type> >::value }; + enum { BlockHdrAlignment = ::boost::container::dtl::alignment_of<block_header<size_type> >::value }; block_header<size_type> *get_block_header() const { diff --git a/boost/interprocess/detail/transform_iterator.hpp b/boost/interprocess/detail/transform_iterator.hpp index 1c4dcd3aeb..d409b52362 100644 --- a/boost/interprocess/detail/transform_iterator.hpp +++ b/boost/interprocess/detail/transform_iterator.hpp @@ -27,170 +27,14 @@ // interprocess #include <boost/interprocess/interprocess_fwd.hpp> -// interprocess/detail -#include <boost/interprocess/detail/type_traits.hpp> -// move/detail -#include <boost/container/detail/iterator.hpp> +// container/detail +#include <boost/container/detail/transform_iterator.hpp> namespace boost { namespace interprocess { -template <class PseudoReference> -struct operator_arrow_proxy -{ - operator_arrow_proxy(const PseudoReference &px) - : m_value(px) - {} - - PseudoReference* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 -// operator T*() const { return &m_value; } - mutable PseudoReference m_value; -}; - -template <class T> -struct operator_arrow_proxy<T&> -{ - operator_arrow_proxy(T &px) - : m_value(px) - {} - - T* operator->() const { return const_cast<T*>(&m_value); } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 -// operator T*() const { return &m_value; } - T &m_value; -}; - -template <class Iterator, class UnaryFunction> -class transform_iterator - : public UnaryFunction -{ - public: - typedef typename ::boost::container::iterator_traits<Iterator>::iterator_category iterator_category; - typedef typename ipcdetail::remove_reference<typename UnaryFunction::result_type>::type value_type; - typedef typename ::boost::container::iterator_traits<Iterator>::difference_type difference_type; - typedef operator_arrow_proxy<typename UnaryFunction::result_type> pointer; - typedef typename UnaryFunction::result_type reference; - - explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction()) - : UnaryFunction(f), m_it(it) - {} - - explicit transform_iterator() - : UnaryFunction(), m_it() - {} - - //Constructors - transform_iterator& operator++() - { increment(); return *this; } - - transform_iterator operator++(int) - { - transform_iterator result (*this); - increment(); - return result; - } - - transform_iterator& operator--() - { decrement(); return *this; } - - transform_iterator operator--(int) - { - transform_iterator result (*this); - decrement(); - return result; - } - - friend bool operator== (const transform_iterator& i, const transform_iterator& i2) - { return i.equal(i2); } - - friend bool operator!= (const transform_iterator& i, const transform_iterator& i2) - { return !(i == i2); } - - friend bool operator< (const transform_iterator& i, const transform_iterator& i2) - { return i < i2; } - - friend bool operator> (const transform_iterator& i, const transform_iterator& i2) - { return i2 < i; } - - friend bool operator<= (const transform_iterator& i, const transform_iterator& i2) - { return !(i > i2); } - - friend bool operator>= (const transform_iterator& i, const transform_iterator& i2) - { return !(i < i2); } - - friend difference_type operator- (const transform_iterator& i, const transform_iterator& i2) - { return i2.distance_to(i); } - - //Arithmetic - transform_iterator& operator+=(difference_type off) - { this->advance(off); return *this; } - - transform_iterator operator+(difference_type off) const - { - transform_iterator other(*this); - other.advance(off); - return other; - } - - friend transform_iterator operator+(difference_type off, const transform_iterator& right) - { return right + off; } - - transform_iterator& operator-=(difference_type off) - { this->advance(-off); return *this; } - - transform_iterator operator-(difference_type off) const - { return *this + (-off); } - - typename UnaryFunction::result_type operator*() const - { return dereference(); } - - typename UnaryFunction::result_type operator[](difference_type off) const - { return UnaryFunction::operator()(m_it[off]); } - - operator_arrow_proxy<typename UnaryFunction::result_type> - operator->() const - { return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); } - - Iterator & base() - { return m_it; } - - const Iterator & base() const - { return m_it; } - - private: - Iterator m_it; - - void increment() - { ++m_it; } - - void decrement() - { --m_it; } - - bool equal(const transform_iterator &other) const - { return m_it == other.m_it; } - - bool less(const transform_iterator &other) const - { return other.m_it < m_it; } - - typename UnaryFunction::result_type dereference() const - { return UnaryFunction::operator()(*m_it); } - - void advance(difference_type n) - { ::boost::container::iterator_advance(m_it, n); } - - difference_type distance_to(const transform_iterator &other)const - { return ::boost::container::iterator_distance(other.m_it, m_it); } -}; - -template <class Iterator, class UnaryFunc> -transform_iterator<Iterator, UnaryFunc> -make_transform_iterator(Iterator it, UnaryFunc fun) -{ - return transform_iterator<Iterator, UnaryFunc>(it, fun); -} +using boost::container::make_transform_iterator; +using boost::container::transform_iterator; } //namespace interprocess { } //namespace boost { diff --git a/boost/interprocess/detail/variadic_templates_tools.hpp b/boost/interprocess/detail/variadic_templates_tools.hpp index c0f591312b..936f702bc2 100644 --- a/boost/interprocess/detail/variadic_templates_tools.hpp +++ b/boost/interprocess/detail/variadic_templates_tools.hpp @@ -25,10 +25,10 @@ namespace boost { namespace interprocess { namespace ipcdetail { -using boost::container::container_detail::tuple; -using boost::container::container_detail::build_number_seq; -using boost::container::container_detail::index_tuple; -using boost::container::container_detail::get; +using boost::container::dtl::tuple; +using boost::container::dtl::build_number_seq; +using boost::container::dtl::index_tuple; +using boost::container::dtl::get; }}} //namespace boost { namespace interprocess { namespace ipcdetail { diff --git a/boost/interprocess/detail/win32_api.hpp b/boost/interprocess/detail/win32_api.hpp index 1ea8cec53d..d12097f512 100644 --- a/boost/interprocess/detail/win32_api.hpp +++ b/boost/interprocess/detail/win32_api.hpp @@ -2035,7 +2035,7 @@ inline bool get_registry_value_string(hkey key_type, const char *subkey_name, co unsigned long size; unsigned long type; long err = reg_query_value_ex( key, value_name, 0, &type, 0, &size); - if((reg_sz == type || reg_expand_sz != type) && !err){ + if((reg_sz == type || reg_expand_sz == type) && !err){ //Size includes terminating NULL s.resize(size); err = reg_query_value_ex( key, value_name, 0, &type, (unsigned char*)(&s[0]), &size); diff --git a/boost/interprocess/detail/workaround.hpp b/boost/interprocess/detail/workaround.hpp index bdee15a031..53cd3eb2c4 100644 --- a/boost/interprocess/detail/workaround.hpp +++ b/boost/interprocess/detail/workaround.hpp @@ -31,7 +31,7 @@ ////////////////////////////////////////////////////// //Check for XSI shared memory objects. They are available in nearly all UNIX platforms ////////////////////////////////////////////////////// - #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) + #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS #endif |