mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Library headers: Use Container's addressof and local static assert to reduce dependencies. Use BOOST_INTERPROCESS_TRY/CATCH when possible.
This commit is contained in:
@@ -26,8 +26,7 @@
|
||||
|
||||
#include <boost/interprocess/interprocess_fwd.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/container/detail/addressof.hpp>
|
||||
#include <boost/interprocess/detail/utilities.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp>
|
||||
@@ -84,7 +83,7 @@ class adaptive_pool_base
|
||||
};
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
|
||||
BOOST_STATIC_ASSERT((Version <=2));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Version <=2));
|
||||
|
||||
public:
|
||||
//-------
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <boost/interprocess/containers/version_type.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/container/detail/addressof.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
@@ -249,12 +249,12 @@ class allocator
|
||||
//!Returns address of mutable object.
|
||||
//!Never throws
|
||||
pointer address(reference value) const
|
||||
{ return pointer(boost::addressof(value)); }
|
||||
{ return pointer(boost::container::dtl::addressof(value)); }
|
||||
|
||||
//!Returns address of non mutable object.
|
||||
//!Never throws
|
||||
const_pointer address(const_reference value) const
|
||||
{ return const_pointer(boost::addressof(value)); }
|
||||
{ return const_pointer(boost::container::dtl::addressof(value)); }
|
||||
};
|
||||
|
||||
//!Equality test for same type
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <boost/interprocess/interprocess_fwd.hpp>
|
||||
#include <boost/interprocess/detail/utilities.hpp> //to_raw_pointer
|
||||
#include <boost/utility/addressof.hpp> //boost::addressof
|
||||
#include <boost/container/detail/addressof.hpp> //boost::container::dtl:addressof
|
||||
#include <boost/assert.hpp> //BOOST_ASSERT
|
||||
#include <boost/interprocess/exceptions.hpp> //bad_alloc
|
||||
#include <boost/interprocess/sync/scoped_lock.hpp> //scoped_lock
|
||||
@@ -205,7 +205,7 @@ class cache_impl
|
||||
void cached_allocation(size_type n, multiallocation_chain &chain)
|
||||
{
|
||||
size_type count = n, allocated(0);
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//If don't have any cached node, we have to get a new list of free nodes from the pool
|
||||
while(!m_cached_nodes.empty() && count--){
|
||||
void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front());
|
||||
@@ -217,10 +217,10 @@ class cache_impl
|
||||
mp_node_pool->allocate_nodes(n - allocated, chain);
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
this->cached_deallocation(chain);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
void cached_deallocation(void *ptr)
|
||||
@@ -389,12 +389,12 @@ class array_allocation_impl
|
||||
//!Returns address of mutable object.
|
||||
//!Never throws
|
||||
pointer address(reference value) const
|
||||
{ return pointer(boost::addressof(value)); }
|
||||
{ return pointer(boost::container::dtl::addressof(value)); }
|
||||
|
||||
//!Returns address of non mutable object.
|
||||
//!Never throws
|
||||
const_pointer address(const_reference value) const
|
||||
{ return const_pointer(boost::addressof(value)); }
|
||||
{ return const_pointer(boost::container::dtl::addressof(value)); }
|
||||
|
||||
//!Constructs an object
|
||||
//!Throws if T's constructor throws
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include <boost/interprocess/interprocess_fwd.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/container/detail/addressof.hpp>
|
||||
#include <boost/interprocess/detail/utilities.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/interprocess/allocators/detail/node_pool.hpp>
|
||||
@@ -81,7 +80,7 @@ class node_allocator_base
|
||||
};
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
|
||||
BOOST_STATIC_ASSERT((Version <=2));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Version <=2));
|
||||
|
||||
public:
|
||||
//-------
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include <boost/interprocess/interprocess_fwd.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/container/detail/addressof.hpp>
|
||||
#include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp>
|
||||
#include <boost/interprocess/containers/version_type.hpp>
|
||||
#include <boost/container/detail/multiallocation_chain.hpp>
|
||||
@@ -81,7 +80,7 @@ class private_adaptive_pool_base
|
||||
, OverheadPercent
|
||||
> node_pool_t;
|
||||
|
||||
BOOST_STATIC_ASSERT((Version <=2));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Version <=2));
|
||||
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include <boost/interprocess/interprocess_fwd.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/container/detail/addressof.hpp>
|
||||
#include <boost/interprocess/allocators/detail/node_pool.hpp>
|
||||
#include <boost/interprocess/containers/version_type.hpp>
|
||||
#include <boost/container/detail/multiallocation_chain.hpp>
|
||||
@@ -75,7 +74,7 @@ class private_node_allocator_base
|
||||
, NodesPerBlock
|
||||
> node_pool_t;
|
||||
|
||||
BOOST_STATIC_ASSERT((Version <=2));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Version <=2));
|
||||
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class intermodule_singleton_common
|
||||
}
|
||||
}
|
||||
if(previous_module_singleton_initialized == Uninitialized){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Now initialize the global map, this function must solve concurrency
|
||||
//issues between threads of several modules
|
||||
initialize_global_map_handle();
|
||||
@@ -143,11 +143,11 @@ class intermodule_singleton_common
|
||||
//before this one. Now marked as initialized
|
||||
atomic_write32(&this_module_singleton_initialized, Initialized);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
//Mark singleton failed to initialize
|
||||
atomic_write32(&this_module_singleton_initialized, Broken);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
//If previous state was initializing, this means that another winner thread is
|
||||
//trying to initialize the singleton. Just wait until completes its work.
|
||||
@@ -232,7 +232,7 @@ class intermodule_singleton_common
|
||||
}
|
||||
else{ //(tmp == Uninitialized)
|
||||
//If not initialized try it again?
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Remove old global map from the system
|
||||
intermodule_singleton_helpers::thread_safe_global_map_dependant<ThreadSafeGlobalMap>::remove_old_gmem();
|
||||
//in-place construction of the global map class
|
||||
@@ -255,10 +255,10 @@ class intermodule_singleton_common
|
||||
break;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
//
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,17 +406,17 @@ class intermodule_singleton_impl
|
||||
<ThreadSafeGlobalMap>::find(m_map, typeid(C).name());
|
||||
if(!rcount){
|
||||
C *p = new C;
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
ref_count_ptr val(p, 0u);
|
||||
rcount = intermodule_singleton_helpers::thread_safe_global_map_dependant
|
||||
<ThreadSafeGlobalMap>::insert(m_map, typeid(C).name(), val);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
intermodule_singleton_helpers::thread_safe_global_map_dependant
|
||||
<ThreadSafeGlobalMap>::erase(m_map, typeid(C).name());
|
||||
delete p;
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
//if(Phoenix){
|
||||
std::atexit(&atexit_work);
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <boost/interprocess/detail/nothrow.hpp>
|
||||
#include <boost/interprocess/detail/simple_swap.hpp>
|
||||
//
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
//
|
||||
#include <boost/intrusive/detail/minimal_pair_header.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
@@ -115,7 +114,7 @@ class basic_managed_memory_impl
|
||||
{
|
||||
typedef typename ManagedMemory::device_type device_type;
|
||||
//Increase file size
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
offset_t old_size;
|
||||
{
|
||||
device_type f(open_or_create, filename, read_write);
|
||||
@@ -127,9 +126,9 @@ class basic_managed_memory_impl
|
||||
//Grow always works
|
||||
managed_memory.self_t::grow(extra_bytes);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -138,15 +137,15 @@ class basic_managed_memory_impl
|
||||
{
|
||||
typedef typename ManagedMemory::device_type device_type;
|
||||
size_type new_size;
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
ManagedMemory managed_memory(open_only, filename);
|
||||
managed_memory.get_size();
|
||||
managed_memory.self_t::shrink_to_fit();
|
||||
new_size = managed_memory.get_size();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
//Decrease file size
|
||||
{
|
||||
@@ -175,14 +174,14 @@ class basic_managed_memory_impl
|
||||
|
||||
//This function should not throw. The index construction can
|
||||
//throw if constructor allocates memory. So we must catch it.
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Let's construct the allocator in memory
|
||||
BOOST_ASSERT((0 == (std::size_t)addr % boost::move_detail::alignment_of<segment_manager>::value));
|
||||
mp_header = ::new(addr, boost_container_new_t()) segment_manager(size);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,14 +307,14 @@ class managed_open_or_create_impl
|
||||
spin_wait swait;
|
||||
unsigned tries = 0;
|
||||
while(1){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
create_device<FileBased>(dev, id, size, perm, file_like_t());
|
||||
return true;
|
||||
}
|
||||
BOOST_CATCH(interprocess_exception &ex){
|
||||
BOOST_INTERPROCESS_CATCH(interprocess_exception &ex){
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(ex.get_error_code() != already_exists_error){
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
}
|
||||
else if (++tries == MaxCreateOrOpenTries) {
|
||||
//File existing when trying to create, but non-existing when
|
||||
@@ -323,25 +323,25 @@ class managed_open_or_create_impl
|
||||
throw interprocess_exception(error_info(corrupted_error));
|
||||
}
|
||||
else{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
DeviceAbstraction tmp(open_only, id, read_write);
|
||||
dev.swap(tmp);
|
||||
return false;
|
||||
}
|
||||
BOOST_CATCH(interprocess_exception &e){
|
||||
BOOST_INTERPROCESS_CATCH(interprocess_exception &e){
|
||||
if(e.get_error_code() != not_found_error){
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
#endif //#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
swait.yield();
|
||||
}
|
||||
return false;
|
||||
@@ -352,7 +352,7 @@ class managed_open_or_create_impl
|
||||
(DeviceAbstraction &dev, mapped_region &final_region,
|
||||
std::size_t size, const void *addr, ConstructFunc construct_func)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//If this throws, we are lost
|
||||
truncate_device<FileBased>(dev, static_cast<offset_t>(size), file_like_t());
|
||||
|
||||
@@ -363,16 +363,16 @@ class managed_open_or_create_impl
|
||||
boost::uint32_t previous = atomic_cas32(patomic_word, InitializingSegment, UninitializedSegment);
|
||||
|
||||
if(previous == UninitializedSegment){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
construct_func( static_cast<char*>(region.get_address()) + ManagedOpenOrCreateUserOffset
|
||||
, size - ManagedOpenOrCreateUserOffset, true);
|
||||
//All ok, just move resources to the external mapped region
|
||||
final_region.swap(region);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
atomic_write32(patomic_word, CorruptedSegment);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
atomic_write32(patomic_word, InitializedSegment);
|
||||
}
|
||||
else{
|
||||
@@ -380,16 +380,16 @@ class managed_open_or_create_impl
|
||||
throw interprocess_exception(error_info(corrupted_error));
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
truncate_device<FileBased>(dev, 1u, file_like_t());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
template <class ConstructFunc>
|
||||
@@ -533,16 +533,16 @@ class managed_open_or_create_impl
|
||||
boost::uint32_t previous = atomic_cas32(patomic_word, InitializingSegment, UninitializedSegment);
|
||||
|
||||
if(previous == UninitializedSegment){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
construct_func( static_cast<char*>(region.get_address()) + ManagedOpenOrCreateUserOffset
|
||||
, size - ManagedOpenOrCreateUserOffset, true);
|
||||
//All ok, just move resources to the external mapped region
|
||||
m_mapped_region.swap(region);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
atomic_write32(patomic_word, CorruptedSegment);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
atomic_write32(patomic_word, InitializedSegment);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace interprocess {
|
||||
@@ -97,7 +97,7 @@ inline std::size_t floor_log2 (std::size_t x)
|
||||
{
|
||||
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
|
||||
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
|
||||
BOOST_STATIC_ASSERT(((Size_t_Bits_Power_2)== true));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT(((Size_t_Bits_Power_2)== true));
|
||||
|
||||
std::size_t n = x;
|
||||
std::size_t log2 = 0;
|
||||
|
||||
@@ -67,17 +67,17 @@ struct CtorArgN : public placement_destroy<T>
|
||||
virtual void construct_n(void *mem, std::size_t num) BOOST_OVERRIDE
|
||||
{
|
||||
std::size_t constructed = 0;
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
T* memory = static_cast<T*>(mem);
|
||||
for(constructed = 0; constructed < num; ++constructed){
|
||||
this->construct(memory++, IsIterator(), index_tuple_t());
|
||||
this->do_increment(IsIterator(), index_tuple_t());
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
BOOST_INTERPROCESS_CATCH(...) {
|
||||
this->placement_destroy<T>::destroy_n(mem, constructed);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -157,16 +157,16 @@ struct CtorArg##N : placement_destroy<T>\
|
||||
virtual void construct_n(void *mem, std::size_t num) BOOST_OVERRIDE\
|
||||
{\
|
||||
std::size_t constructed = 0;\
|
||||
BOOST_TRY{\
|
||||
BOOST_INTERPROCESS_TRY{\
|
||||
T* memory = static_cast<T*>(mem);\
|
||||
for (constructed = 0; constructed < num; ++constructed) {\
|
||||
::new((void*)memory++) T ( BOOST_MOVE_MFWD##N );\
|
||||
}\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
BOOST_INTERPROCESS_CATCH(...) {\
|
||||
this->placement_destroy<T>::destroy_n(mem, constructed);\
|
||||
BOOST_RETHROW\
|
||||
} BOOST_CATCH_END\
|
||||
BOOST_INTERPROCESS_RETHROW\
|
||||
} BOOST_INTERPROCESS_CATCH_END\
|
||||
}\
|
||||
\
|
||||
private:\
|
||||
@@ -194,17 +194,17 @@ struct CtorIt##N : public placement_destroy<T>\
|
||||
virtual void construct_n(void *mem, std::size_t num) BOOST_OVERRIDE\
|
||||
{\
|
||||
std::size_t constructed = 0;\
|
||||
BOOST_TRY{\
|
||||
BOOST_INTERPROCESS_TRY{\
|
||||
T* memory = static_cast<T*>(mem);\
|
||||
for(constructed = 0; constructed < num; ++constructed){\
|
||||
::new((void*)memory++) T( BOOST_MOVE_MITFWD##N );\
|
||||
++(*this);\
|
||||
}\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
BOOST_INTERPROCESS_CATCH(...) {\
|
||||
this->placement_destroy<T>::destroy_n(mem, constructed);\
|
||||
BOOST_RETHROW\
|
||||
} BOOST_CATCH_END\
|
||||
BOOST_INTERPROCESS_RETHROW\
|
||||
} BOOST_INTERPROCESS_CATCH_END\
|
||||
}\
|
||||
\
|
||||
private:\
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
#include <boost/interprocess/errors.hpp>
|
||||
#include <boost/interprocess/permissions.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <climits>
|
||||
#include <string>
|
||||
@@ -593,7 +592,7 @@ inline bool delete_file(const char *name)
|
||||
inline bool truncate_file (file_handle_t hnd, std::size_t size)
|
||||
{
|
||||
typedef boost::move_detail::make_unsigned<off_t>::type uoff_t;
|
||||
BOOST_STATIC_ASSERT(( sizeof(uoff_t) >= sizeof(std::size_t) ));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT(( sizeof(uoff_t) >= sizeof(std::size_t) ));
|
||||
if( uoff_t(-1)/2u < uoff_t(size) ){
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
|
||||
@@ -152,7 +152,7 @@ struct thread_safe_global_map_dependant<managed_global_memory>
|
||||
static void apply_gmem_erase_logic(const char *filepath, const char *filename)
|
||||
{
|
||||
int fd = GMemMarkToBeRemoved;
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
std::string str;
|
||||
//If the filename is current process lock file, then avoid it
|
||||
if(check_if_filename_complies_with_pid
|
||||
@@ -167,21 +167,21 @@ struct thread_safe_global_map_dependant<managed_global_memory>
|
||||
//If done, then the process is dead so take global shared memory name
|
||||
//(the name is based on the lock file name) and try to apply erasure logic
|
||||
str.insert(0, get_map_base_name());
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
managed_global_memory shm(open_only, str.c_str());
|
||||
gmem_erase_func func(str.c_str(), filepath, shm);
|
||||
shm.try_atomic_func(func);
|
||||
}
|
||||
BOOST_CATCH(interprocess_exception &e){
|
||||
BOOST_INTERPROCESS_CATCH(interprocess_exception &e){
|
||||
//If shared memory is not found erase the lock file
|
||||
if(e.get_error_code() == not_found_error){
|
||||
delete_file(filepath);
|
||||
}
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
if(fd >= 0){
|
||||
close_lock_file(fd);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// other boost
|
||||
#include <boost/assert.hpp> //BOOST_ASSERT
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
// std
|
||||
#include <cstddef> //std::size_t
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <boost/interprocess/detail/mpl.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <climits>
|
||||
|
||||
@@ -80,9 +79,9 @@ inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple)
|
||||
template <std::size_t OrigSize, std::size_t RoundTo>
|
||||
struct ct_rounded_size
|
||||
{
|
||||
BOOST_STATIC_ASSERT((RoundTo != 0));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((RoundTo != 0));
|
||||
static const std::size_t intermediate_value = (OrigSize-1)/RoundTo+1;
|
||||
BOOST_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo);
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo);
|
||||
static const std::size_t value = intermediate_value*RoundTo;
|
||||
};
|
||||
|
||||
@@ -151,7 +150,7 @@ template<std::size_t SztSizeOfType, class SizeType>
|
||||
BOOST_INTERPROCESS_FORCEINLINE bool size_overflows(SizeType count)
|
||||
{
|
||||
//Compile time-check
|
||||
BOOST_STATIC_ASSERT(SztSizeOfType <= SizeType(-1));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT(SztSizeOfType <= SizeType(-1));
|
||||
//Runtime check
|
||||
return multiplication_overflows(SizeType(SztSizeOfType), count);
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ inline bool unlink_file(const CharT *filename)
|
||||
//- Close the handle. If there are no file users, it will be deleted.
|
||||
// Otherwise it will be used by already connected handles but the
|
||||
// file name can't be used to open this file again
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
NtSetInformationFile_t pNtSetInformationFile =
|
||||
reinterpret_cast<NtSetInformationFile_t>(dll_func::get(dll_func::NtSetInformationFile));
|
||||
|
||||
@@ -1418,9 +1418,9 @@ inline bool unlink_file(const CharT *filename)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
|
||||
interprocess_exception(const char *err) BOOST_NOEXCEPT
|
||||
: m_err(other_error)
|
||||
{
|
||||
BOOST_TRY { m_str = err; }
|
||||
BOOST_CATCH(...) {} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_TRY { m_str = err; }
|
||||
BOOST_INTERPROCESS_CATCH(...) {} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
interprocess_exception(const error_info &err_info, const char *str = 0)
|
||||
: m_err(err_info)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
if(m_err.get_native_error() != 0){
|
||||
fill_system_message(m_err.get_native_error(), m_str);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
|
||||
m_str = "boost::interprocess_exception::library_error";
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH(...){} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
~interprocess_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {}
|
||||
|
||||
@@ -288,15 +288,15 @@ class iunordered_set_index
|
||||
new_n = index_type::suggested_upper_bucket_count(new_n);
|
||||
bucket_ptr new_p;
|
||||
//This can throw
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
if(old_p != bucket_ptr(&this->init_bucket))
|
||||
new_p = expand_or_create_buckets(old_p, old_n, this->alloc, new_n);
|
||||
else
|
||||
new_p = create_buckets(this->alloc, new_n);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
//Rehashing does not throw, since neither the hash nor the
|
||||
//comparison function can throw
|
||||
this->rehash(bucket_traits(new_p, new_n));
|
||||
@@ -324,12 +324,12 @@ class iunordered_set_index
|
||||
if(sug_count >= cur_count)
|
||||
return;
|
||||
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
shrink_buckets(old_p, cur_count, this->alloc, sug_count);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
//Rehashing does not throw, since neither the hash nor the
|
||||
//comparison function can throw
|
||||
@@ -352,10 +352,10 @@ class iunordered_set_index
|
||||
iterator it = index_type::insert_commit(val, commit_data);
|
||||
size_type cur_size = this->size();
|
||||
if(cur_size > this->bucket_count()){
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
this->reserve(cur_size);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
//Strong guarantee: if something goes wrong
|
||||
//we should remove the insertion.
|
||||
//
|
||||
@@ -364,8 +364,8 @@ class iunordered_set_index
|
||||
//throw only because of the memory allocation:
|
||||
//the iterator has not been invalidated.
|
||||
index_type::erase(it);
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
return it;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <boost/interprocess/creation_tags.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
#include <boost/interprocess/permissions.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/move/detail/type_traits.hpp> //make_unsigned, alignment_of
|
||||
@@ -685,12 +684,12 @@ class msg_queue_initialization_func_t
|
||||
if(created){
|
||||
mptr = reinterpret_cast<char*>(address);
|
||||
//Construct the message queue header at the beginning
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
new (mptr) mq_hdr_t<VoidPointer>(m_maxmsg, m_maxmsgsize);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -863,7 +862,7 @@ inline bool message_queue_t<VoidPointer>::do_send(
|
||||
{
|
||||
//If the queue is full execute blocking logic
|
||||
if (p_hdr->is_full()) {
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
#ifdef BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
|
||||
++p_hdr->m_blocked_senders;
|
||||
#endif
|
||||
@@ -903,12 +902,12 @@ inline bool message_queue_t<VoidPointer>::do_send(
|
||||
--p_hdr->m_blocked_senders;
|
||||
#endif
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
#ifdef BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
|
||||
--p_hdr->m_blocked_senders;
|
||||
#endif
|
||||
BOOST_RETHROW;
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW;
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
#if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX)
|
||||
@@ -991,7 +990,7 @@ inline bool
|
||||
{
|
||||
//If there are no messages execute blocking logic
|
||||
if (p_hdr->is_empty()) {
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
#if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX)
|
||||
++p_hdr->m_blocked_receivers;
|
||||
#endif
|
||||
@@ -1033,12 +1032,12 @@ inline bool
|
||||
--p_hdr->m_blocked_receivers;
|
||||
#endif
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
#if defined(BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX)
|
||||
--p_hdr->m_blocked_receivers;
|
||||
#endif
|
||||
BOOST_RETHROW;
|
||||
} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_RETHROW;
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
#ifdef BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <vector>
|
||||
#include <boost/interprocess/detail/managed_memory_impl.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
//These includes needed to fulfill default template parameters of
|
||||
//predeclarations in interprocess_fwd.hpp
|
||||
#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
|
||||
@@ -107,13 +106,13 @@ class basic_managed_heap_memory
|
||||
{
|
||||
//If memory is reallocated, data will
|
||||
//be automatically copied
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
m_heapmem.resize(m_heapmem.size()+extra_bytes);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
//Grow always works
|
||||
base_t::close_impl();
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
// move/detail
|
||||
#include <boost/move/detail/force_ptr.hpp>
|
||||
// other boost
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
//!\file
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <boost/intrusive/set.hpp>
|
||||
// other boost
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
// std
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
@@ -340,9 +339,9 @@ class rbtree_best_fit
|
||||
|
||||
private:
|
||||
//Due to embedded bits in size, Alignment must be at least 4
|
||||
BOOST_STATIC_ASSERT((Alignment >= 4));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Alignment >= 4));
|
||||
//Due to rbtree size optimizations, Alignment must have at least pointer alignment
|
||||
BOOST_STATIC_ASSERT((Alignment >= ::boost::container::dtl::alignment_of<void_pointer>::value));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((Alignment >= ::boost::container::dtl::alignment_of<void_pointer>::value));
|
||||
static const size_type AlignmentMask = (Alignment - 1);
|
||||
static const size_type BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
|
||||
static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
|
||||
@@ -354,7 +353,7 @@ class rbtree_best_fit
|
||||
static const size_type UsableByPreviousChunk = sizeof(size_type);
|
||||
|
||||
//Make sure the maximum alignment is power of two
|
||||
BOOST_STATIC_ASSERT((0 == (Alignment & (Alignment - size_type(1u)))));
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((0 == (Alignment & (Alignment - size_type(1u)))));
|
||||
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
|
||||
public:
|
||||
static const size_type PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/interprocess/detail/transform_iterator.hpp>
|
||||
@@ -1105,17 +1104,17 @@ class segment_manager
|
||||
typename index_type_t::insert_commit_data commit_data;
|
||||
typedef typename index_type_t::value_type intrusive_value_type;
|
||||
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
ipcdetail::intrusive_compare_key<CharT> key(name, namelen);
|
||||
insert_ret = index.insert_check(key, commit_data);
|
||||
}
|
||||
//Ignore exceptions
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
if(dothrow)
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
return 0;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
index_it it = insert_ret.first;
|
||||
|
||||
@@ -1158,17 +1157,17 @@ class segment_manager
|
||||
CharT *name_ptr = static_cast<CharT *>(hdr->template name<CharT>());
|
||||
std::char_traits<CharT>::copy(name_ptr, name, namelen+1);
|
||||
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Now commit the insertion using previous context data
|
||||
it = index.insert_commit(*intrusive_hdr, commit_data);
|
||||
}
|
||||
//Ignore exceptions
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
if(dothrow)
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
return 0;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
//Avoid constructions if constructor is trivial
|
||||
//Build scoped ptr to avoid leaks with constructor exception
|
||||
@@ -1229,16 +1228,16 @@ class segment_manager
|
||||
//to insert the node, do an ugly un-const cast and modify
|
||||
//the key (which is a smart pointer) to an equivalent one
|
||||
index_ib insert_ret;
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
insert_ret = index.insert(value_type(key_type (name, namelen), mapped_type(0)));
|
||||
}
|
||||
//Ignore exceptions
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
if(dothrow)
|
||||
BOOST_RETHROW;
|
||||
BOOST_INTERPROCESS_RETHROW;
|
||||
return 0;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
|
||||
index_it it = insert_ret.first;
|
||||
|
||||
|
||||
@@ -269,30 +269,30 @@ inline bool shared_memory_object::priv_open_or_create
|
||||
|
||||
inline bool shared_memory_object::remove(const wchar_t *filename)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Make sure a temporary path is created for shared memory
|
||||
std::wstring shmfile;
|
||||
ipcdetail::shared_filepath(filename, shmfile);
|
||||
return ipcdetail::delete_file(shmfile.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool shared_memory_object::remove(const char *filename)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Make sure a temporary path is created for shared memory
|
||||
std::string shmfile;
|
||||
ipcdetail::shared_filepath(filename, shmfile);
|
||||
return ipcdetail::delete_file(shmfile.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
inline void shared_memory_object::truncate(offset_t length)
|
||||
@@ -432,7 +432,7 @@ inline bool shared_memory_object::priv_open_or_create
|
||||
|
||||
inline bool shared_memory_object::remove(const char *filename)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
std::string filepath;
|
||||
#if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
|
||||
const bool add_leading_slash = false;
|
||||
@@ -449,9 +449,9 @@ inline bool shared_memory_object::remove(const char *filename)
|
||||
}
|
||||
return 0 == shm_unlink(filepath.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
inline void shared_memory_object::truncate(offset_t length)
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp>
|
||||
#include <boost/interprocess/detail/utilities.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/move/adl_move_swap.hpp>
|
||||
#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
@@ -100,7 +99,7 @@ class shared_count
|
||||
shared_count(const Ptr &p, const VoidAllocator &a, Deleter d)
|
||||
: m_px(p), m_pi(0)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
if(p){
|
||||
counted_impl_allocator alloc(a);
|
||||
m_pi = alloc.allocate(1);
|
||||
@@ -114,11 +113,11 @@ class shared_count
|
||||
deallocator.release();
|
||||
}
|
||||
}
|
||||
BOOST_CATCH (...){
|
||||
BOOST_INTERPROCESS_CATCH (...){
|
||||
d(p); // delete p
|
||||
BOOST_RETHROW
|
||||
BOOST_INTERPROCESS_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
~shared_count() // nothrow
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/interprocess/detail/utilities.hpp>
|
||||
#include <boost/interprocess/detail/cast_tags.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/interprocess/smart_ptr/detail/shared_count.hpp>
|
||||
#include <boost/interprocess/detail/mpl.hpp>
|
||||
#include <boost/interprocess/detail/nothrow.hpp>
|
||||
@@ -140,7 +139,7 @@ class shared_ptr
|
||||
pointer_traits<pointer>::template
|
||||
rebind_pointer<T>::type ParameterPointer;
|
||||
|
||||
BOOST_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) ||
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) ||
|
||||
(ipcdetail::is_pointer<pointer>::value));
|
||||
ipcdetail::sp_enable_shared_from_this<T, VoidAllocator, Deleter>( m_pn, ipcdetail::to_raw_pointer(p), ipcdetail::to_raw_pointer(p) );
|
||||
}
|
||||
@@ -245,7 +244,7 @@ class shared_ptr
|
||||
typedef typename boost::intrusive::
|
||||
pointer_traits<Pointer>::template
|
||||
rebind_pointer<T>::type ParameterPointer;
|
||||
BOOST_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) ||
|
||||
BOOST_INTERPROCESS_STATIC_ASSERT((ipcdetail::is_same<pointer, ParameterPointer>::value) ||
|
||||
(ipcdetail::is_pointer<Pointer>::value));
|
||||
this_type(p, a, d).swap(*this);
|
||||
}
|
||||
@@ -397,16 +396,16 @@ template<class T, class ManagedMemory>
|
||||
inline typename managed_shared_ptr<T, ManagedMemory>::type
|
||||
make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory, const std::nothrow_t &)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
return typename managed_shared_ptr<T, ManagedMemory>::type
|
||||
( constructed_object
|
||||
, managed_memory.template get_allocator<void>()
|
||||
, managed_memory.template get_deleter<T>()
|
||||
);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return typename managed_shared_ptr<T, ManagedMemory>::type();
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/smart_ptr/deleter.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@@ -165,15 +164,15 @@ class weak_ptr
|
||||
if(expired()){
|
||||
return shared_ptr<element_type, A, D>();
|
||||
}
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
return shared_ptr<element_type, A, D>(*this);
|
||||
}
|
||||
BOOST_CATCH(bad_weak_ptr const &){
|
||||
BOOST_INTERPROCESS_CATCH(bad_weak_ptr const &){
|
||||
// Q: how can we get here?
|
||||
// A: another thread may have invalidated r after the use_count test above.
|
||||
return shared_ptr<element_type, A, D>();
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
//!Returns: 0 if *this is empty; otherwise, the number of shared_ptr objects
|
||||
|
||||
@@ -122,7 +122,7 @@ inline void semaphore_close(sem_t *handle)
|
||||
|
||||
inline bool semaphore_unlink(const char *semname)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
std::string sem_str;
|
||||
#ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
|
||||
add_leading_slash(semname, sem_str);
|
||||
@@ -131,9 +131,9 @@ inline bool semaphore_unlink(const char *semname)
|
||||
#endif
|
||||
return 0 == sem_unlink(sem_str.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
#endif //BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
|
||||
|
||||
@@ -253,8 +253,8 @@ class scoped_lock
|
||||
//!Notes: The destructor behavior ensures that the mutex lock is not leaked.*/
|
||||
~scoped_lock()
|
||||
{
|
||||
BOOST_TRY{ if(m_locked && mp_mutex) mp_mutex->unlock(); }
|
||||
BOOST_CATCH(...){} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_TRY{ if(m_locked && mp_mutex) mp_mutex->unlock(); }
|
||||
BOOST_INTERPROCESS_CATCH(...){} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
//!Effects: If owns() before the call, then unlock() is called on mutex().
|
||||
|
||||
@@ -182,10 +182,10 @@ class sharable_lock
|
||||
//!Notes: The destructor behavior ensures that the mutex lock is not leaked.
|
||||
~sharable_lock()
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
if(m_locked && mp_mutex) mp_mutex->unlock_sharable();
|
||||
}
|
||||
BOOST_CATCH(...){} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH(...){} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
//!Effects: If owns() before the call, then unlock_sharable() is called on mutex().
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/sync/cv_status.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/interprocess/creation_tags.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
|
||||
#include <boost/interprocess/sync/cv_status.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/interprocess/detail/type_traits.hpp>
|
||||
#include <boost/interprocess/creation_tags.hpp>
|
||||
#include <boost/interprocess/exceptions.hpp>
|
||||
|
||||
@@ -184,10 +184,10 @@ class upgradable_lock
|
||||
//!Notes: The destructor behavior ensures that the mutex lock is not leaked.
|
||||
~upgradable_lock()
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
if(m_locked && mp_mutex) mp_mutex->unlock_upgradable();
|
||||
}
|
||||
BOOST_CATCH(...){} BOOST_CATCH_END
|
||||
BOOST_INTERPROCESS_CATCH(...){} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
//!Effects: If owns(), then unlock_upgradable() is called on mutex().
|
||||
|
||||
@@ -204,28 +204,28 @@ inline void windows_named_sync::open_or_create
|
||||
|
||||
inline bool windows_named_sync::remove(const char *name)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Make sure a temporary path is created for shared memory
|
||||
std::string semfile;
|
||||
ipcdetail::shared_filepath(name, semfile);
|
||||
return winapi::unlink_file(semfile.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
inline bool windows_named_sync::remove(const wchar_t *name)
|
||||
{
|
||||
BOOST_TRY{
|
||||
BOOST_INTERPROCESS_TRY{
|
||||
//Make sure a temporary path is created for shared memory
|
||||
std::wstring semfile;
|
||||
ipcdetail::shared_filepath(name, semfile);
|
||||
return winapi::unlink_file(semfile.c_str());
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
BOOST_INTERPROCESS_CATCH(...){
|
||||
return false;
|
||||
} BOOST_CATCH_END
|
||||
} BOOST_INTERPROCESS_CATCH_END
|
||||
}
|
||||
|
||||
} //namespace ipcdetail {
|
||||
|
||||
@@ -162,7 +162,7 @@ class windows_shared_memory
|
||||
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
|
||||
|
||||
inline windows_shared_memory::windows_shared_memory() BOOST_NOEXCEPT
|
||||
: m_handle(0)
|
||||
: m_handle(0), m_mode(), m_name()
|
||||
{}
|
||||
|
||||
inline windows_shared_memory::~windows_shared_memory()
|
||||
|
||||
Reference in New Issue
Block a user