Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80688 - in trunk: boost/interprocess/detail boost/interprocess/mem_algo boost/interprocess/mem_algo/detail libs/interprocess/doc libs/interprocess/example
From: igaztanaga_at_[hidden]
Date: 2012-09-24 06:41:49


Author: igaztanaga
Date: 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
New Revision: 80688
URL: http://svn.boost.org/trac/boost/changeset/80688

Log:
Fixed broken multiallocation_chain due to container library changes
Text files modified:
   trunk/boost/interprocess/detail/utilities.hpp | 2 +-
   trunk/boost/interprocess/detail/win32_api.hpp | 30 +++++++++++++-----------------
   trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 32 ++++++++++++++++++++++++++++++++
   trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 3 +--
   trunk/libs/interprocess/doc/interprocess.qbk | 9 +++++----
   trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp | 3 +--
   6 files changed, 53 insertions(+), 26 deletions(-)

Modified: trunk/boost/interprocess/detail/utilities.hpp
==============================================================================
--- trunk/boost/interprocess/detail/utilities.hpp (original)
+++ trunk/boost/interprocess/detail/utilities.hpp 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -189,7 +189,7 @@
 
 template<class SizeType>
 inline bool sum_overflows(SizeType a, SizeType b)
-{ return SizeType(-1) - a > b; }
+{ return SizeType(-1) - a < b; }
 
 //Anti-exception node eraser
 template<class Cont>

Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -241,17 +241,16 @@
    } value;
 };
 
- struct IUnknown_BIPC
- {
- public:
- virtual long __stdcall QueryInterface(
- /* [in] */ const GUID_BIPC &riid,
- /* [iid_is][out] */ void **ppvObject) = 0;
-
- virtual unsigned long __stdcall AddRef( void) = 0;
+struct IUnknown_BIPC
+{
+ public:
+ virtual long __stdcall QueryInterface(
+ const GUID_BIPC &riid, // [in]
+ void **ppvObject) = 0; // [iid_is][out]
 
- virtual unsigned long __stdcall Release( void) = 0;
- };
+ virtual unsigned long __stdcall AddRef (void) = 0;
+ virtual unsigned long __stdcall Release(void) = 0;
+};
 
 struct IWbemClassObject_BIPC : public IUnknown_BIPC
 {
@@ -359,7 +358,6 @@
 
 };
 
-
 struct IWbemContext_BIPC : public IUnknown_BIPC
 {
 public:
@@ -587,8 +585,6 @@
 
 };
 
-
-
 struct interprocess_overlapped
 {
    unsigned long *internal;
@@ -663,7 +659,7 @@
     unsigned short wProcessorRevision;
 };
 
-typedef struct _interprocess_memory_basic_information
+struct interprocess_memory_basic_information
 {
    void * BaseAddress;
    void * AllocationBase;
@@ -672,16 +668,16 @@
    unsigned long State;
    unsigned long Protect;
    unsigned long Type;
-} interprocess_memory_basic_information;
+};
 
-typedef struct _interprocess_acl
+struct interprocess_acl
 {
    unsigned char AclRevision;
    unsigned char Sbz1;
    unsigned short AclSize;
    unsigned short AceCount;
    unsigned short Sbz2;
-} interprocess_acl;
+};
 
 typedef struct _interprocess_security_descriptor
 {

Modified: trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -26,6 +26,7 @@
 #include <boost/interprocess/detail/utilities.hpp>
 #include <boost/move/move.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
+#include <boost/container/detail/multiallocation_chain.hpp>
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <algorithm>
@@ -40,6 +41,37 @@
 namespace interprocess {
 namespace ipcdetail {
 
+template<class VoidPointer>
+class basic_multiallocation_chain
+ : public boost::container::container_detail::
+ basic_multiallocation_chain<VoidPointer>
+{
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
+ typedef boost::container::container_detail::
+ basic_multiallocation_chain<VoidPointer> base_t;
+ public:
+
+ basic_multiallocation_chain()
+ : base_t()
+ {}
+
+ basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
+ : base_t(::boost::move(static_cast<base_t&>(other)))
+ {}
+
+ basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
+ {
+ this->base_t::operator=(::boost::move(static_cast<base_t&>(other)));
+ return *this;
+ }
+
+ void *pop_front()
+ {
+ return boost::interprocess::ipcdetail::to_raw_pointer(this->base_t::pop_front());
+ }
+};
+
+
 //!This class implements several allocation functions shared by different algorithms
 //!(aligned allocation, multiple allocation...).
 template<class MemoryAlgorithm>

Modified: trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -88,8 +88,7 @@
    typedef MutexFamily mutex_family;
    //!Pointer type to be used with the rest of the Interprocess framework
    typedef VoidPointer void_pointer;
- typedef boost::container::container_detail::
- basic_multiallocation_chain<VoidPointer> multiallocation_chain;
+ typedef ipcdetail::basic_multiallocation_chain<VoidPointer> multiallocation_chain;
 
    typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
    typedef typename boost::make_unsigned<difference_type>::type size_type;

Modified: trunk/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- trunk/libs/interprocess/doc/interprocess.qbk (original)
+++ trunk/libs/interprocess/doc/interprocess.qbk 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -6719,23 +6719,24 @@
 [section:release_notes_boost_1_52_00 Boost 1.52 Release]
 
 * Added `shrink_by` and `advise` functions in `mapped_region`.
-* Reimplemented `message_queue` with a circular buffer index (the
+* [*ABI breaking]Reimplemented `message_queue` with a circular buffer index (the
    old behavior used an ordered array, leading to excessive copies). This
    should greatly increase performance but breaks ABI. Old behaviour/ABI can be used
    undefining macro `BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX` in `boost/interprocess/detail/workaround.hpp`
 * Improved `message_queue` insertion time avoiding priority search for common cases
    (both array and circular buffer configurations).
 * Implemented `sharable_mutex` and `interproces_condition_any`.
+* Improved `offset_ptr` performance.
+* Added integer overflow checks.
 
 [endsect]
 
-
 [section:release_notes_boost_1_51_00 Boost 1.51 Release]
 
 * Synchronous and asynchronous flushing for `mapped_region::flush`.
-* Source & ABI breaking: Removed `get_offset` method from `mapped_region` as
+* [*Source & ABI breaking]: Removed `get_offset` method from `mapped_region` as
    it has no practical utility and `m_offset` member was not for anything else.
-* Source & ABI breaking: Removed `flush` from `managed_shared_memory`.
+* [*Source & ABI breaking]: Removed `flush` from `managed_shared_memory`.
    as it is unspecified according to POSIX:
    [@http://pubs.opengroup.org/onlinepubs/009695399/functions/msync.html
    ['"The effect of msync() on a shared memory object or a typed memory object is unspecified"] ].

Modified: trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp
==============================================================================
--- trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp (original)
+++ trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp 2012-09-24 06:41:48 EDT (Mon, 24 Sep 2012)
@@ -64,8 +64,7 @@
 
    //Initialize our data
    while(!chain.empty()){
- void *buf = chain.front();
- chain.pop_front();
+ void *buf = chain.pop_front();
       allocated_buffers.push_back(buf);
       //The iterator must be incremented before overwriting memory
       //because otherwise, the iterator is invalidated.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk