update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -24,6 +24,7 @@
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/simple_swap.hpp>
#include <boost/interprocess/detail/char_wchar_holder.hpp>
#if !defined(BOOST_INTERPROCESS_WINDOWS)
#error "This header can only be used in Windows operating systems"
@@ -38,7 +39,7 @@
#include <boost/interprocess/detail/win32_api.hpp>
#include <cstddef>
#include <boost/cstdint.hpp>
#include <string>
//!\file
//!Describes a class representing a native windows shared memory.
@@ -67,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".
@@ -86,17 +87,34 @@ class windows_shared_memory
windows_shared_memory(open_only_t, const char *name, mode_t mode)
{ this->priv_open_or_create(ipcdetail::DoOpen, name, mode, 0, permissions()); }
//!Creates a new native shared memory with name "name" and at least size "size",
//!with the access mode "mode".
//!If the file previously exists, throws an error.
windows_shared_memory(create_only_t, const wchar_t *name, mode_t mode, std::size_t size, const permissions& perm = permissions())
{ this->priv_open_or_create(ipcdetail::DoCreate, name, mode, size, perm); }
//!Tries to create a shared memory object with name "name" and at least size "size", with the
//!access mode "mode". If the file previously exists, it tries to open it with mode "mode".
//!Otherwise throws an error.
windows_shared_memory(open_or_create_t, const wchar_t *name, mode_t mode, std::size_t size, const permissions& perm = permissions())
{ this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, size, perm); }
//!Tries to open a shared memory object with name "name", with the access mode "mode".
//!If the file does not previously exist, it throws an error.
windows_shared_memory(open_only_t, const wchar_t *name, mode_t mode)
{ this->priv_open_or_create(ipcdetail::DoOpen, name, mode, 0, permissions()); }
//!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);
@@ -104,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
@@ -113,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:
@@ -132,49 +150,56 @@ class windows_shared_memory
void priv_close();
//!Closes a previously opened file mapping. Never throws.
bool priv_open_or_create(ipcdetail::create_enum_t type, const char *filename, mode_t mode, std::size_t size, const permissions& perm = permissions());
template <class CharT>
bool priv_open_or_create(ipcdetail::create_enum_t type, const CharT *filename, mode_t mode, std::size_t size, const permissions& perm = permissions());
void * m_handle;
mode_t m_mode;
std::string m_name;
char_wchar_holder m_name;
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
#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
{ return m_name.c_str(); }
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;
}
template <class CharT>
inline bool windows_shared_memory::priv_open_or_create
(ipcdetail::create_enum_t type, const char *filename, mode_t mode, std::size_t size, const permissions& perm)
(ipcdetail::create_enum_t type, const CharT *filename, mode_t mode, std::size_t size, const permissions& perm)
{
m_name = filename ? filename : "";
if (filename){
m_name = filename;
}
else{
m_name = "";
}
unsigned long protection = 0;
unsigned long map_access = 0;