Boost logo

Boost-Commit :

From: igaztanaga_at_[hidden]
Date: 2007-08-25 15:19:35


Author: igaztanaga
Date: 2007-08-25 15:19:34 EDT (Sat, 25 Aug 2007)
New Revision: 38955
URL: http://svn.boost.org/trac/boost/changeset/38955

Log:
#1211: Interprocess tests hang when run in parallel
#1080 boost::interprocess win32 global file mapping issue
Removed:
   trunk/boost/interprocess/smart_ptr/segment_deleter.hpp
Text files modified:
   trunk/boost/interprocess/detail/algorithms.hpp | 29 +++++++++++++++++++++++++++--
   trunk/boost/interprocess/detail/os_thread_functions.hpp | 8 ++++++++
   trunk/boost/interprocess/detail/utilities.hpp | 24 ------------------------
   3 files changed, 35 insertions(+), 26 deletions(-)

Modified: trunk/boost/interprocess/detail/algorithms.hpp
==============================================================================
--- trunk/boost/interprocess/detail/algorithms.hpp (original)
+++ trunk/boost/interprocess/detail/algorithms.hpp 2007-08-25 15:19:34 EDT (Sat, 25 Aug 2007)
@@ -20,11 +20,19 @@
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
 #include <boost/interprocess/detail/iterators.hpp>
+#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
 #include <boost/get_pointer.hpp>
 #include <boost/detail/no_exceptions_support.hpp>
 
 namespace boost {
-namespace interprocess {
+namespace interprocess {
+
+template<class T>
+struct has_own_construct_from_it
+{
+ static const bool value = false;
+};
 
 template<class FwdIt, class T>
 void uninitialized_fill(FwdIt first, FwdIt last, const T& val)
@@ -106,12 +114,29 @@
    return (constructed);
 }
 
+namespace detail {
+
 template<class T, class InpIt>
-inline void construct_in_place(T* dest, InpIt source)
+inline void construct_in_place(T* dest, const InpIt &source, detail::true_)
+{
+ T::construct(dest, *source);
+}
+
+template<class T, class InpIt>
+inline void construct_in_place(T* dest, const InpIt &source, detail::false_)
 {
    new(dest)T(*source);
 }
 
+} //namespace detail {
+
+template<class T, class InpIt>
+inline void construct_in_place(T* dest, InpIt source)
+{
+ typedef detail::bool_<has_own_construct_from_it<T>::value> boolean_t;
+ detail::construct_in_place(dest, source, boolean_t());
+}
+
 template<class T, class U, class D>
 inline void construct_in_place(T *dest, default_construct_iterator<U, D>)
 {

Modified: trunk/boost/interprocess/detail/os_thread_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_thread_functions.hpp (original)
+++ trunk/boost/interprocess/detail/os_thread_functions.hpp 2007-08-25 15:19:34 EDT (Sat, 25 Aug 2007)
@@ -32,8 +32,12 @@
 
 #if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
 
+typedef unsigned long OS_process_id_t;
 typedef unsigned long OS_thread_id_t;
 
+inline OS_process_id_t get_current_process_id()
+{ return winapi::get_current_process_id(); }
+
 inline OS_thread_id_t get_current_thread_id()
 { return winapi::get_current_thread_id(); }
 
@@ -49,6 +53,10 @@
 #else //#if (defined BOOST_WINDOWS) && !(defined BOOST_DISABLE_WIN32)
 
 typedef pthread_t OS_thread_id_t;
+typedef int OS_process_id_t;
+
+inline OS_process_id_t get_current_process_id()
+{ return getpid(); }
 
 inline pthread_t get_current_thread_id()
 { return pthread_self(); }

Modified: trunk/boost/interprocess/detail/utilities.hpp
==============================================================================
--- trunk/boost/interprocess/detail/utilities.hpp (original)
+++ trunk/boost/interprocess/detail/utilities.hpp 2007-08-25 15:19:34 EDT (Sat, 25 Aug 2007)
@@ -344,30 +344,6 @@
    enum { value = false };
 };
 
-/*!A Interprocess shared pointer deleter that uses the segment manager's
- destroy_ptr function to destroy the shared resource.*/
-template<class T, class SegmentManager>
-class deleter
-{
- public:
- typedef typename detail::pointer_to_other
- <typename SegmentManager::void_pointer, T>::type pointer;
-
- private:
- typedef typename detail::pointer_to_other
- <pointer, SegmentManager>::type segment_manager_pointer;
-
- segment_manager_pointer mp_deleter;
-
- public:
- deleter(const segment_manager_pointer &pdeleter)
- : mp_deleter(pdeleter)
- {}
-
- void operator()(const pointer &p)
- { mp_deleter->destroy_ptr(detail::get_pointer(p)); }
-};
-
 template <class SizeType>
 SizeType
    get_next_capacity(const SizeType max_size

Deleted: trunk/boost/interprocess/smart_ptr/segment_deleter.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/segment_deleter.hpp 2007-08-25 15:19:34 EDT (Sat, 25 Aug 2007)
+++ (empty file)
@@ -1,59 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-2007. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERPROCESS_SMART_PTR_SEGMENT_DELETER_HPP
-#define BOOST_INTERPROCESS_SMART_PTR_SEGMENT_DELETER_HPP
-
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-# pragma warning (disable : 4503)
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
-
-//!\file
-//!Describes a deleter for smart pointers that deletes the
-//!object using the segment manager
-
-namespace boost {
-namespace interprocess {
-
-template < class SegmentManager
- , class VoidPointer = typename SegmentManager::void_pointer>
-struct segment_deleter
-{
- typedef typename detail::pointer_to_other
- <VoidPointer, SegmentManager>::type SegmentManagerPtr;
-
- segment_deleter(SegmentManagerPtr mngr)
- : m_mngr(mngr)
- {}
-
- template<class Ptr>
- void operator() (const Ptr &ptr) const
- {
- m_mngr->destroy_ptr(detail::get_pointer(ptr));
- }
-
- /// @cond
- private:
- SegmentManagerPtr m_mngr;
- /// @endcond
-};
-
-
-} //namespace interprocess {
-} //namespace boost {
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif //#ifndef BOOST_INTERPROCESS_SMART_PTR_SEGMENT_DELETER_HPP


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