Fixes #122 ("Mark constructors/assignment/swap noexcept where possible")

This commit is contained in:
Ion Gaztañaga
2021-02-16 00:01:04 +01:00
parent 9f40b16e9c
commit 75ecc955d3
15 changed files with 111 additions and 109 deletions

View File

@@ -6806,10 +6806,11 @@ thank them:
* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/76 GitHub #76 (['"Cygwin compilation errors"])].
* [@https://github.com/boostorg/interprocess/pull/83 GitHub #83 (['"Add BOOST_INTERPROCESS_FORCE_NATIVE_EMULATION option"])].
* [@https://github.com/boostorg/interprocess/pull/92 GitHub #92 (['"bufferstream: Correct MSVC compilation warning"])].
* [@https://github.com/boostorg/interprocess/pull/106 GitHub #106 (['"Use fallocate on truncate_file"])].
* [@https://github.com/boostorg/interprocess/issues/122 GitHub #122 (['"Mark constructors/assignment/swap noexcept where possible"])].
* [@https://github.com/boostorg/interprocess/issues/126 GitHub #126 (['"_ReadWriteBarrier is deprecated warning when compiling with clang-cl.exe"])].
* [@https://github.com/boostorg/interprocess/pull/83 GitHub #83 (['"Add BOOST_INTERPROCESS_FORCE_NATIVE_EMULATION option"])].
[endsect]

View File

@@ -36,7 +36,7 @@ namespace interprocess {
class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
{
public:
interprocess_exception(const char *err)
interprocess_exception(const char *err) BOOST_NOEXCEPT
: m_err(other_error)
{
try { m_str = err; }
@@ -65,10 +65,10 @@ class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{ return m_str.c_str(); }
native_error_t get_native_error()const { return m_err.get_native_error(); }
native_error_t get_native_error() const BOOST_NOEXCEPT { return m_err.get_native_error(); }
// Note: a value of other_error implies a library (rather than system) error
error_code_t get_error_code() const { return m_err.get_error_code(); }
error_code_t get_error_code() const BOOST_NOEXCEPT { return m_err.get_error_code(); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
@@ -82,7 +82,7 @@ class BOOST_SYMBOL_VISIBLE interprocess_exception : public std::exception
class BOOST_SYMBOL_VISIBLE lock_exception : public interprocess_exception
{
public:
lock_exception()
lock_exception() BOOST_NOEXCEPT
: interprocess_exception(lock_error)
{}

View File

@@ -52,7 +52,7 @@ class file_mapping
public:
//!Constructs an empty file mapping.
//!Does not throw
file_mapping();
file_mapping() BOOST_NOEXCEPT;
//!Opens a file mapping of file "filename", starting in offset
//!"file_offset", and the mapping's size will be "size". The mapping
@@ -74,7 +74,7 @@ class file_mapping
//!Moves the ownership of "moved"'s file mapping object to *this.
//!After the call, "moved" does not represent any file mapping object.
//!Does not throw
file_mapping(BOOST_RV_REF(file_mapping) moved)
file_mapping(BOOST_RV_REF(file_mapping) moved) BOOST_NOEXCEPT
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only)
{ this->swap(moved); }
@@ -82,7 +82,7 @@ class file_mapping
//!Moves the ownership of "moved"'s file mapping to *this.
//!After the call, "moved" does not represent any file mapping.
//!Does not throw
file_mapping &operator=(BOOST_RV_REF(file_mapping) moved)
file_mapping &operator=(BOOST_RV_REF(file_mapping) moved) BOOST_NOEXCEPT
{
file_mapping tmp(boost::move(moved));
this->swap(tmp);
@@ -91,15 +91,15 @@ class file_mapping
//!Swaps to file_mappings.
//!Does not throw.
void swap(file_mapping &other);
void swap(file_mapping &other) BOOST_NOEXCEPT;
//!Returns access mode
//!used in the constructor
mode_t get_mode() const;
mode_t get_mode() const BOOST_NOEXCEPT;
//!Obtains the mapping handle
//!to be used with mapped_region
mapping_handle_t get_mapping_handle() const;
mapping_handle_t get_mapping_handle() const BOOST_NOEXCEPT;
//!Destroys the file mapping. All mapped regions created from this are still
//!valid. Does not throw
@@ -107,7 +107,7 @@ class file_mapping
//!Returns the name of the file
//!used in the constructor.
const char *get_name() const;
const char *get_name() const BOOST_NOEXCEPT;
//!Removes the file named "filename" even if it's been memory mapped.
//!Returns true on success.
@@ -136,7 +136,7 @@ class file_mapping
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
inline file_mapping::file_mapping()
inline file_mapping::file_mapping() BOOST_NOEXCEPT
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only)
{}
@@ -144,20 +144,20 @@ inline file_mapping::file_mapping()
inline file_mapping::~file_mapping()
{ this->priv_close(); }
inline const char *file_mapping::get_name() const
inline const char *file_mapping::get_name() const BOOST_NOEXCEPT
{ return m_filename.getn(); }
inline void file_mapping::swap(file_mapping &other)
inline void file_mapping::swap(file_mapping &other) BOOST_NOEXCEPT
{
(simple_swap)(m_handle, other.m_handle);
(simple_swap)(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
inline mapping_handle_t file_mapping::get_mapping_handle() const
inline mapping_handle_t file_mapping::get_mapping_handle() const BOOST_NOEXCEPT
{ return ipcdetail::mapping_handle_from_file_handle(m_handle); }
inline mode_t file_mapping::get_mode() const
inline mode_t file_mapping::get_mode() const BOOST_NOEXCEPT
{ return m_mode; }
inline file_mapping::file_mapping

View File

@@ -60,7 +60,7 @@ class basic_managed_external_buffer
//!Default constructor. Does nothing.
//!Useful in combination with move semantics
basic_managed_external_buffer()
basic_managed_external_buffer() BOOST_NOEXCEPT
{}
//!Creates and places the segment manager. This can throw
@@ -86,13 +86,13 @@ class basic_managed_external_buffer
}
//!Moves the ownership of "moved"'s managed memory to *this. Does not throw
basic_managed_external_buffer(BOOST_RV_REF(basic_managed_external_buffer) moved)
basic_managed_external_buffer(BOOST_RV_REF(basic_managed_external_buffer) moved) BOOST_NOEXCEPT
{
this->swap(moved);
}
//!Moves the ownership of "moved"'s managed memory to *this. Does not throw
basic_managed_external_buffer &operator=(BOOST_RV_REF(basic_managed_external_buffer) moved)
basic_managed_external_buffer &operator=(BOOST_RV_REF(basic_managed_external_buffer) moved) BOOST_NOEXCEPT
{
basic_managed_external_buffer tmp(boost::move(moved));
this->swap(tmp);
@@ -104,7 +104,7 @@ class basic_managed_external_buffer
//!Swaps the ownership of the managed heap memories managed by *this and other.
//!Never throws.
void swap(basic_managed_external_buffer &other)
void swap(basic_managed_external_buffer &other) BOOST_NOEXCEPT
{ base_t::swap(other); }
};

View File

@@ -63,7 +63,8 @@ class basic_managed_heap_memory
//!Default constructor. Does nothing.
//!Useful in combination with move semantics
basic_managed_heap_memory(){}
basic_managed_heap_memory() BOOST_NOEXCEPT
{}
//!Destructor. Liberates the heap memory holding the managed data.
//!Never throws.
@@ -82,11 +83,11 @@ class basic_managed_heap_memory
}
//!Moves the ownership of "moved"'s managed memory to *this. Does not throw
basic_managed_heap_memory(BOOST_RV_REF(basic_managed_heap_memory) moved)
basic_managed_heap_memory(BOOST_RV_REF(basic_managed_heap_memory) moved) BOOST_NOEXCEPT
{ this->swap(moved); }
//!Moves the ownership of "moved"'s managed memory to *this. Does not throw
basic_managed_heap_memory &operator=(BOOST_RV_REF(basic_managed_heap_memory) moved)
basic_managed_heap_memory &operator=(BOOST_RV_REF(basic_managed_heap_memory) moved) BOOST_NOEXCEPT
{
basic_managed_heap_memory tmp(boost::move(moved));
this->swap(tmp);
@@ -123,7 +124,7 @@ class basic_managed_heap_memory
//!Swaps the ownership of the managed heap memories managed by *this and other.
//!Never throws.
void swap(basic_managed_heap_memory &other)
void swap(basic_managed_heap_memory &other) BOOST_NOEXCEPT
{
base_t::swap(other);
m_heapmem.swap(other.m_heapmem);

View File

@@ -110,7 +110,7 @@ class basic_managed_mapped_file
//!Creates mapped file and creates and places the segment manager.
//!This can throw.
basic_managed_mapped_file()
basic_managed_mapped_file() BOOST_NOEXCEPT
{}
//!Creates mapped file and creates and places the segment manager.
@@ -232,14 +232,14 @@ class basic_managed_mapped_file
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_mapped_file(BOOST_RV_REF(basic_managed_mapped_file) moved)
basic_managed_mapped_file(BOOST_RV_REF(basic_managed_mapped_file) moved) BOOST_NOEXCEPT
{
this->swap(moved);
}
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_mapped_file &operator=(BOOST_RV_REF(basic_managed_mapped_file) moved)
basic_managed_mapped_file &operator=(BOOST_RV_REF(basic_managed_mapped_file) moved) BOOST_NOEXCEPT
{
basic_managed_mapped_file tmp(boost::move(moved));
this->swap(tmp);
@@ -257,7 +257,7 @@ class basic_managed_mapped_file
//!Swaps the ownership of the managed mapped memories managed by *this and other.
//!Never throws.
void swap(basic_managed_mapped_file &other)
void swap(basic_managed_mapped_file &other) BOOST_NOEXCEPT
{
base_t::swap(other);
m_mfile.swap(other.m_mfile);

View File

@@ -110,7 +110,7 @@ class basic_managed_windows_shared_memory
//!Default constructor. Does nothing.
//!Useful in combination with move semantics
basic_managed_windows_shared_memory()
basic_managed_windows_shared_memory() BOOST_NOEXCEPT
{}
//!Creates shared memory and creates and places the segment manager.
@@ -209,12 +209,12 @@ class basic_managed_windows_shared_memory
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_windows_shared_memory
(BOOST_RV_REF(basic_managed_windows_shared_memory) moved)
(BOOST_RV_REF(basic_managed_windows_shared_memory) moved) BOOST_NOEXCEPT
{ this->swap(moved); }
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_windows_shared_memory &operator=(BOOST_RV_REF(basic_managed_windows_shared_memory) moved)
basic_managed_windows_shared_memory &operator=(BOOST_RV_REF(basic_managed_windows_shared_memory) moved) BOOST_NOEXCEPT
{
basic_managed_windows_shared_memory tmp(boost::move(moved));
this->swap(tmp);
@@ -231,7 +231,7 @@ class basic_managed_windows_shared_memory
//!Swaps the ownership of the managed mapped memories managed by *this and other.
//!Never throws.
void swap(basic_managed_windows_shared_memory &other)
void swap(basic_managed_windows_shared_memory &other) BOOST_NOEXCEPT
{
base_t::swap(other);
m_wshm.swap(other.m_wshm);

View File

@@ -122,7 +122,7 @@ class basic_managed_xsi_shared_memory
//!Default constructor. Does nothing.
//!Useful in combination with move semantics
basic_managed_xsi_shared_memory()
basic_managed_xsi_shared_memory() BOOST_NOEXCEPT
{}
//!Creates shared memory and creates and places the segment manager.
@@ -170,7 +170,7 @@ class basic_managed_xsi_shared_memory
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_xsi_shared_memory(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved)
basic_managed_xsi_shared_memory(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved) BOOST_NOEXCEPT
{
basic_managed_xsi_shared_memory tmp;
this->swap(moved);
@@ -179,7 +179,7 @@ class basic_managed_xsi_shared_memory
//!Moves the ownership of "moved"'s managed memory to *this.
//!Does not throw
basic_managed_xsi_shared_memory &operator=(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved)
basic_managed_xsi_shared_memory &operator=(BOOST_RV_REF(basic_managed_xsi_shared_memory) moved) BOOST_NOEXCEPT
{
basic_managed_xsi_shared_memory tmp(boost::move(moved));
this->swap(tmp);
@@ -188,7 +188,7 @@ class basic_managed_xsi_shared_memory
//!Swaps the ownership of the managed shared memories managed by *this and other.
//!Never throws.
void swap(basic_managed_xsi_shared_memory &other)
void swap(basic_managed_xsi_shared_memory &other) BOOST_NOEXCEPT
{
base_t::swap(other);
base2_t::swap(other);
@@ -200,7 +200,7 @@ class basic_managed_xsi_shared_memory
static bool remove(int shmid)
{ return device_type::remove(shmid); }
int get_shmid() const
int get_shmid() const BOOST_NOEXCEPT
{ return base2_t::get_device().get_shmid(); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)

View File

@@ -136,11 +136,11 @@ class mapped_region
//!Default constructor. Address will be 0 (nullptr).
//!Size will be 0.
//!Does not throw
mapped_region();
mapped_region() BOOST_NOEXCEPT;
//!Move constructor. *this will be constructed taking ownership of "other"'s
//!region and "other" will be left in default constructor state.
mapped_region(BOOST_RV_REF(mapped_region) other)
mapped_region(BOOST_RV_REF(mapped_region) other) BOOST_NOEXCEPT
#if defined (BOOST_INTERPROCESS_WINDOWS)
: m_base(0), m_size(0)
, m_page_offset(0)
@@ -157,7 +157,7 @@ class mapped_region
//!Move assignment. If *this owns a memory mapped region, it will be
//!destroyed and it will take ownership of "other"'s memory mapped region.
mapped_region &operator=(BOOST_RV_REF(mapped_region) other)
mapped_region &operator=(BOOST_RV_REF(mapped_region) other) BOOST_NOEXCEPT
{
mapped_region tmp(boost::move(other));
this->swap(tmp);
@@ -166,18 +166,18 @@ class mapped_region
//!Swaps the mapped_region with another
//!mapped region
void swap(mapped_region &other);
void swap(mapped_region &other) BOOST_NOEXCEPT;
//!Returns the size of the mapping. Never throws.
std::size_t get_size() const;
std::size_t get_size() const BOOST_NOEXCEPT;
//!Returns the base address of the mapping.
//!Never throws.
void* get_address() const;
void* get_address() const BOOST_NOEXCEPT;
//!Returns the mode of the mapping used to construct the mapped region.
//!Never throws.
mode_t get_mode() const;
mode_t get_mode() const BOOST_NOEXCEPT;
//!Flushes to the disk a byte range within the mapped memory.
//!If 'async' is true, the function will return before flushing operation is completed
@@ -225,7 +225,7 @@ class mapped_region
//!Returns the size of the page. This size is the minimum memory that
//!will be used by the system when mapping a memory mappable source and
//!will restrict the address and the offset to map.
static std::size_t get_page_size();
static std::size_t get_page_size() BOOST_NOEXCEPT;
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
@@ -269,19 +269,19 @@ class mapped_region
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline void swap(mapped_region &x, mapped_region &y)
inline void swap(mapped_region &x, mapped_region &y) BOOST_NOEXCEPT
{ x.swap(y); }
inline mapped_region::~mapped_region()
{ this->priv_close(); }
inline std::size_t mapped_region::get_size() const
inline std::size_t mapped_region::get_size() const BOOST_NOEXCEPT
{ return m_size; }
inline mode_t mapped_region::get_mode() const
inline mode_t mapped_region::get_mode() const BOOST_NOEXCEPT
{ return m_mode; }
inline void* mapped_region::get_address() const
inline void* mapped_region::get_address() const BOOST_NOEXCEPT
{ return m_base; }
inline void* mapped_region::priv_map_address() const
@@ -375,7 +375,7 @@ inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, cons
#if defined (BOOST_INTERPROCESS_WINDOWS)
inline mapped_region::mapped_region()
inline mapped_region::mapped_region() BOOST_NOEXCEPT
: m_base(0), m_size(0), m_page_offset(0), m_mode(read_only)
, m_file_or_mapping_hnd(ipcdetail::invalid_file())
{}
@@ -573,7 +573,7 @@ inline void mapped_region::dont_close_on_destruction()
#else //#if defined (BOOST_INTERPROCESS_WINDOWS)
inline mapped_region::mapped_region()
inline mapped_region::mapped_region() BOOST_NOEXCEPT
: m_base(0), m_size(0), m_page_offset(0), m_mode(read_only), m_is_xsi(false)
{}
@@ -852,7 +852,7 @@ template<int dummy>
const std::size_t mapped_region::page_size_holder<dummy>::PageSize
= mapped_region::page_size_holder<dummy>::get_page_size();
inline std::size_t mapped_region::get_page_size()
inline std::size_t mapped_region::get_page_size() BOOST_NOEXCEPT
{
if(!page_size_holder<0>::PageSize)
return page_size_holder<0>::get_page_size();
@@ -860,7 +860,7 @@ inline std::size_t mapped_region::get_page_size()
return page_size_holder<0>::PageSize;
}
inline void mapped_region::swap(mapped_region &other)
inline void mapped_region::swap(mapped_region &other) BOOST_NOEXCEPT
{
::boost::adl_move_swap(this->m_base, other.m_base);
::boost::adl_move_swap(this->m_size, other.m_size);

View File

@@ -79,20 +79,20 @@ class permissions
public:
//!Constructs a permissions object from a user provided os-dependent
//!permissions.
permissions(os_permissions_type type)
permissions(os_permissions_type type) BOOST_NOEXCEPT
: m_perm(type)
{}
//!Constructs a default permissions object:
//!A null security attributes pointer for windows or 0644
//!for UNIX.
permissions()
permissions() BOOST_NOEXCEPT
{ set_default(); }
//!Sets permissions to default values:
//!A null security attributes pointer for windows or 0644
//!for UNIX.
void set_default()
void set_default() BOOST_NOEXCEPT
{
#if defined (BOOST_INTERPROCESS_WINDOWS)
m_perm = 0;
@@ -103,7 +103,7 @@ class permissions
//!Sets permissions to unrestricted access:
//!A null DACL for windows or 0666 for UNIX.
void set_unrestricted()
void set_unrestricted() BOOST_NOEXCEPT
{
#if defined (BOOST_INTERPROCESS_WINDOWS)
m_perm = &ipcdetail::unrestricted_permissions_holder<0>::unrestricted;
@@ -114,12 +114,12 @@ class permissions
//!Sets permissions from a user provided os-dependent
//!permissions.
void set_permissions(os_permissions_type perm)
void set_permissions(os_permissions_type perm) BOOST_NOEXCEPT
{ m_perm = perm; }
//!Returns stored os-dependent
//!permissions
os_permissions_type get_permissions() const
os_permissions_type get_permissions() const BOOST_NOEXCEPT
{ return m_perm; }
};

View File

@@ -65,7 +65,7 @@ class shared_memory_object
public:
//!Default constructor. Represents an empty shared_memory_object.
shared_memory_object();
shared_memory_object() BOOST_NOEXCEPT;
//!Creates a shared memory object with name "name" and mode "mode", with the access mode "mode"
//!If the file previously exists, throws an error.*/
@@ -115,7 +115,7 @@ class shared_memory_object
//!Moves the ownership of "moved"'s shared memory object to *this.
//!After the call, "moved" does not represent any shared memory object.
//!Does not throw
shared_memory_object(BOOST_RV_REF(shared_memory_object) moved)
shared_memory_object(BOOST_RV_REF(shared_memory_object) moved) BOOST_NOEXCEPT
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only)
{ this->swap(moved); }
@@ -123,7 +123,7 @@ class shared_memory_object
//!Moves the ownership of "moved"'s shared memory to *this.
//!After the call, "moved" does not represent any shared memory.
//!Does not throw
shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved)
shared_memory_object &operator=(BOOST_RV_REF(shared_memory_object) moved) BOOST_NOEXCEPT
{
shared_memory_object tmp(boost::move(moved));
this->swap(tmp);
@@ -131,7 +131,7 @@ class shared_memory_object
}
//!Swaps the shared_memory_objects. Does not throw
void swap(shared_memory_object &moved);
void swap(shared_memory_object &moved) BOOST_NOEXCEPT;
//!Erases a shared memory object from the system.
//!Returns false on error. Never throws
@@ -161,17 +161,17 @@ class shared_memory_object
~shared_memory_object();
//!Returns the name of the shared memory object.
const char *get_name() const;
const char *get_name() const BOOST_NOEXCEPT;
//!Returns true if the size of the shared memory object
//!can be obtained and writes the size in the passed reference
bool get_size(offset_t &size) const;
bool get_size(offset_t &size) const BOOST_NOEXCEPT;
//!Returns access mode
mode_t get_mode() const;
mode_t get_mode() const BOOST_NOEXCEPT;
//!Returns mapping handle. Never throws.
mapping_handle_t get_mapping_handle() const;
mapping_handle_t get_mapping_handle() const BOOST_NOEXCEPT;
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
@@ -191,7 +191,7 @@ class shared_memory_object
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline shared_memory_object::shared_memory_object()
inline shared_memory_object::shared_memory_object() BOOST_NOEXCEPT
: m_handle(file_handle_t(ipcdetail::invalid_file()))
, m_mode(read_only)
{}
@@ -200,25 +200,25 @@ inline shared_memory_object::~shared_memory_object()
{ this->priv_close(); }
inline const char *shared_memory_object::get_name() const
inline const char *shared_memory_object::get_name() const BOOST_NOEXCEPT
{ return m_filename.getn(); }
inline bool shared_memory_object::get_size(offset_t &size) const
inline bool shared_memory_object::get_size(offset_t &size) const BOOST_NOEXCEPT
{ return ipcdetail::get_file_size((file_handle_t)m_handle, size); }
inline void shared_memory_object::swap(shared_memory_object &other)
inline void shared_memory_object::swap(shared_memory_object &other) BOOST_NOEXCEPT
{
boost::adl_move_swap(m_handle, other.m_handle);
boost::adl_move_swap(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
inline mapping_handle_t shared_memory_object::get_mapping_handle() const
inline mapping_handle_t shared_memory_object::get_mapping_handle() const BOOST_NOEXCEPT
{
return ipcdetail::mapping_handle_from_file_handle(m_handle);
}
inline mode_t shared_memory_object::get_mode() const
inline mode_t shared_memory_object::get_mode() const BOOST_NOEXCEPT
{ return m_mode; }
#if !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)

View File

@@ -52,7 +52,7 @@ class deleter
segment_manager_pointer mp_mngr;
public:
deleter(segment_manager_pointer pmngr)
deleter(segment_manager_pointer pmngr) BOOST_NOEXCEPT
: mp_mngr(pmngr)
{}

View File

@@ -91,49 +91,49 @@ class scoped_ptr
//!Assigns internal pointer as 0 and returns previous pointer. This will
//!avoid deletion on destructor
pointer release()
pointer release() BOOST_NOEXCEPT
{ pointer tmp(m_ptr); m_ptr = 0; return tmp; }
//!Returns a reference to the object pointed to by the stored pointer.
//!Never throws.
reference operator*() const
reference operator*() const BOOST_NOEXCEPT
{ BOOST_ASSERT(m_ptr != 0); return *m_ptr; }
//!Returns the internal stored pointer.
//!Never throws.
pointer &operator->()
pointer &operator->() BOOST_NOEXCEPT
{ BOOST_ASSERT(m_ptr != 0); return m_ptr; }
//!Returns the internal stored pointer.
//!Never throws.
const pointer &operator->() const
const pointer &operator->() const BOOST_NOEXCEPT
{ BOOST_ASSERT(m_ptr != 0); return m_ptr; }
//!Returns the stored pointer.
//!Never throws.
pointer & get()
pointer & get() BOOST_NOEXCEPT
{ return m_ptr; }
//!Returns the stored pointer.
//!Never throws.
const pointer & get() const
const pointer & get() const BOOST_NOEXCEPT
{ return m_ptr; }
typedef pointer this_type::*unspecified_bool_type;
//!Conversion to bool
//!Never throws
operator unspecified_bool_type() const
operator unspecified_bool_type() const BOOST_NOEXCEPT
{ return m_ptr == 0? 0: &this_type::m_ptr; }
//!Returns true if the stored pointer is 0.
//!Never throws.
bool operator! () const // never throws
bool operator! () const BOOST_NOEXCEPT // never throws
{ return m_ptr == 0; }
//!Exchanges the internal pointer and deleter with other scoped_ptr
//!Never throws.
void swap(scoped_ptr & b) // never throws
void swap(scoped_ptr & b) BOOST_NOEXCEPT // never throws
{
::boost::adl_move_swap(static_cast<Deleter&>(*this), static_cast<Deleter&>(b));
::boost::adl_move_swap(m_ptr, b.m_ptr);
@@ -148,7 +148,7 @@ class scoped_ptr
//!Exchanges the internal pointer and deleter with other scoped_ptr
//!Never throws.
template<class T, class D> inline
void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b)
void swap(scoped_ptr<T, D> & a, scoped_ptr<T, D> & b) BOOST_NOEXCEPT
{ a.swap(b); }
//!Returns a copy of the stored pointer

View File

@@ -68,7 +68,7 @@ class windows_shared_memory
public:
//!Default constructor.
//!Represents an empty windows_shared_memory.
windows_shared_memory();
windows_shared_memory() BOOST_NOEXCEPT;
//!Creates a new native shared memory with name "name" and at least size "size",
//!with the access mode "mode".
@@ -107,14 +107,14 @@ class windows_shared_memory
//!Moves the ownership of "moved"'s shared memory object to *this.
//!After the call, "moved" does not represent any shared memory object.
//!Does not throw
windows_shared_memory(BOOST_RV_REF(windows_shared_memory) moved)
windows_shared_memory(BOOST_RV_REF(windows_shared_memory) moved) BOOST_NOEXCEPT
: m_handle(0)
{ this->swap(moved); }
//!Moves the ownership of "moved"'s shared memory to *this.
//!After the call, "moved" does not represent any shared memory.
//!Does not throw
windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved)
windows_shared_memory &operator=(BOOST_RV_REF(windows_shared_memory) moved) BOOST_NOEXCEPT
{
windows_shared_memory tmp(boost::move(moved));
this->swap(tmp);
@@ -122,7 +122,7 @@ class windows_shared_memory
}
//!Swaps to shared_memory_objects. Does not throw
void swap(windows_shared_memory &other);
void swap(windows_shared_memory &other) BOOST_NOEXCEPT;
//!Destroys *this. All mapped regions are still valid after
//!destruction. When all mapped regions and windows_shared_memory
@@ -131,17 +131,17 @@ class windows_shared_memory
~windows_shared_memory();
//!Returns the name of the shared memory.
const char *get_name() const;
const char *get_name() const BOOST_NOEXCEPT;
//!Returns access mode
mode_t get_mode() const;
mode_t get_mode() const BOOST_NOEXCEPT;
//!Returns the mapping handle. Never throws
mapping_handle_t get_mapping_handle() const;
mapping_handle_t get_mapping_handle() const BOOST_NOEXCEPT;
//!Returns the size of the windows shared memory. It will be a 4K rounded
//!size of the "size" passed in the constructor.
offset_t get_size() const;
offset_t get_size() const BOOST_NOEXCEPT;
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
@@ -161,30 +161,30 @@ class windows_shared_memory
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline windows_shared_memory::windows_shared_memory()
inline windows_shared_memory::windows_shared_memory() BOOST_NOEXCEPT
: m_handle(0)
{}
inline windows_shared_memory::~windows_shared_memory()
{ this->priv_close(); }
inline const char *windows_shared_memory::get_name() const
inline const char *windows_shared_memory::get_name() const BOOST_NOEXCEPT
{ return m_name.getn(); }
inline void windows_shared_memory::swap(windows_shared_memory &other)
inline void windows_shared_memory::swap(windows_shared_memory &other) BOOST_NOEXCEPT
{
(simple_swap)(m_handle, other.m_handle);
(simple_swap)(m_mode, other.m_mode);
m_name.swap(other.m_name);
}
inline mapping_handle_t windows_shared_memory::get_mapping_handle() const
inline mapping_handle_t windows_shared_memory::get_mapping_handle() const BOOST_NOEXCEPT
{ mapping_handle_t mhnd = { m_handle, true}; return mhnd; }
inline mode_t windows_shared_memory::get_mode() const
inline mode_t windows_shared_memory::get_mode() const BOOST_NOEXCEPT
{ return m_mode; }
inline offset_t windows_shared_memory::get_size() const
inline offset_t windows_shared_memory::get_size() const BOOST_NOEXCEPT
{
offset_t size; //This shall never fail
return (m_handle && winapi::get_file_mapping_size(m_handle, size)) ? size : 0;

View File

@@ -69,7 +69,7 @@ class xsi_shared_memory
public:
//!Default constructor.
//!Represents an empty xsi_shared_memory.
xsi_shared_memory();
xsi_shared_memory() BOOST_NOEXCEPT;
//!Initializes *this with a shmid previously obtained (possibly from another process)
//!This lower-level initializer allows shared memory mapping without having a key.
@@ -95,14 +95,14 @@ class xsi_shared_memory
//!Moves the ownership of "moved"'s shared memory object to *this.
//!After the call, "moved" does not represent any shared memory object.
//!Does not throw
xsi_shared_memory(BOOST_RV_REF(xsi_shared_memory) moved)
xsi_shared_memory(BOOST_RV_REF(xsi_shared_memory) moved) BOOST_NOEXCEPT
: m_shmid(-1)
{ this->swap(moved); }
//!Moves the ownership of "moved"'s shared memory to *this.
//!After the call, "moved" does not represent any shared memory.
//!Does not throw
xsi_shared_memory &operator=(BOOST_RV_REF(xsi_shared_memory) moved)
xsi_shared_memory &operator=(BOOST_RV_REF(xsi_shared_memory) moved) BOOST_NOEXCEPT
{
xsi_shared_memory tmp(boost::move(moved));
this->swap(tmp);
@@ -110,7 +110,7 @@ class xsi_shared_memory
}
//!Swaps two xsi_shared_memorys. Does not throw
void swap(xsi_shared_memory &other);
void swap(xsi_shared_memory &other) BOOST_NOEXCEPT;
//!Destroys *this. The shared memory won't be destroyed, just
//!this connection to it. Use remove() to destroy the shared memory.
@@ -118,11 +118,11 @@ class xsi_shared_memory
//!Returns the shared memory ID that
//!identifies the shared memory
int get_shmid() const;
int get_shmid() const BOOST_NOEXCEPT;
//!Returns the mapping handle.
//!Never throws
mapping_handle_t get_mapping_handle() const;
mapping_handle_t get_mapping_handle() const BOOST_NOEXCEPT;
//!Erases the XSI shared memory object identified by shmid
//!from the system.
@@ -143,22 +143,22 @@ class xsi_shared_memory
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline xsi_shared_memory::xsi_shared_memory()
inline xsi_shared_memory::xsi_shared_memory() BOOST_NOEXCEPT
: m_shmid(-1)
{}
inline xsi_shared_memory::~xsi_shared_memory()
{}
inline int xsi_shared_memory::get_shmid() const
inline int xsi_shared_memory::get_shmid() const BOOST_NOEXCEPT
{ return m_shmid; }
inline void xsi_shared_memory::swap(xsi_shared_memory &other)
inline void xsi_shared_memory::swap(xsi_shared_memory &other) BOOST_NOEXCEPT
{
(simple_swap)(m_shmid, other.m_shmid);
}
inline mapping_handle_t xsi_shared_memory::get_mapping_handle() const
inline mapping_handle_t xsi_shared_memory::get_mapping_handle() const BOOST_NOEXCEPT
{ mapping_handle_t mhnd = { m_shmid, true}; return mhnd; }
inline bool xsi_shared_memory::priv_open_or_create