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

@@ -21,6 +21,8 @@
#include <boost/interprocess/detail/config_begin.hpp>
#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>
@@ -28,7 +30,6 @@
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/permissions.hpp>
@@ -66,7 +67,7 @@ class shm_named_condition
public:
//!Creates a global condition with a name.
//!If the condition can't be created throws interprocess_exception
shm_named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions());
shm_named_condition(create_only_t, const char *name, const permissions &perm = permissions());
//!Opens or creates a global condition with a name.
//!If the condition is created, this call is equivalent to
@@ -74,12 +75,42 @@ class shm_named_condition
//!If the condition is already created, this call is equivalent
//!shm_named_condition(open_only_t, ... )
//!Does not throw
shm_named_condition(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
shm_named_condition(open_or_create_t, const char *name, const permissions &perm = permissions());
//!Opens a global condition with a name if that condition is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_condition(open_only_t open_only, const char *name);
shm_named_condition(open_only_t, const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Creates a global condition with a name.
//!If the condition can't be created throws interprocess_exception
//!
//!Note: This function is only available on operating systems with
//! native wchar_t APIs (e.g. Windows).
shm_named_condition(create_only_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens or creates a global condition with a name.
//!If the condition is created, this call is equivalent to
//!shm_named_condition(create_only_t, ... )
//!If the condition is already created, this call is equivalent
//!shm_named_condition(open_only_t, ... )
//!Does not throw
//!
//!Note: This function is only available on operating systems with
//! native wchar_t APIs (e.g. Windows).
shm_named_condition(open_or_create_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens a global condition with a name if that condition is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
//!
//!Note: This function is only available on operating systems with
//! native wchar_t APIs (e.g. Windows).
shm_named_condition(open_only_t, const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Destroys *this and indicates that the calling process is finished using
//!the resource. The destructor function will deallocate
@@ -113,19 +144,54 @@ class shm_named_condition
//!this->notify_one() or this->notify_all(), or until time abs_time is reached,
//!and then reacquires the lock.
//!Returns: false if time abs_time is reached, otherwise true.
template <typename L>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time);
template <typename L, typename TimePoint>
bool timed_wait(L& lock, const TimePoint &abs_time);
//!The same as: while (!pred()) {
//! if (!timed_wait(lock, abs_time)) return pred();
//! } return true;
template <typename L, typename Pr>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred);
template <typename L, typename TimePoint, typename Pr>
bool timed_wait(L& lock, const TimePoint &abs_time, Pr pred);
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface.
template <typename L, class TimePoint>
cv_status wait_until(L& lock, const TimePoint &abs_time)
{ return this->timed_wait(lock, abs_time) ? cv_status::no_timeout : cv_status::timeout; }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface.
template <typename L, class TimePoint, typename Pr>
bool wait_until(L& lock, const TimePoint &abs_time, Pr pred)
{ return this->timed_wait(lock, abs_time, pred); }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface and uses relative timeouts.
template <typename L, class Duration>
cv_status wait_for(L& lock, const Duration &dur)
{ return this->wait_until(lock, ipcdetail::duration_to_ustime(dur)); }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface and uses relative timeouts
template <typename L, class Duration, typename Pr>
bool wait_for(L& lock, const Duration &dur, Pr pred)
{ return this->wait_until(lock, ipcdetail::duration_to_ustime(dur), pred); }
//!Erases a named condition from the system.
//!Returns false on error. Never throws.
static bool remove(const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Erases a named condition from the system.
//!Returns false on error. Never throws.
//!
//!Note: This function is only available on operating systems with
//! native wchar_t APIs (e.g. Windows).
static bool remove(const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
@@ -198,6 +264,40 @@ inline shm_named_condition::shm_named_condition(open_only_t, const char *name)
,construct_func_t(DoOpen))
{}
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline shm_named_condition::shm_named_condition(create_only_t, const wchar_t *name, const permissions &perm)
: m_shmem (create_only
,name
,sizeof(internal_condition) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate)
,perm)
{}
inline shm_named_condition::shm_named_condition(open_or_create_t, const wchar_t *name, const permissions &perm)
: m_shmem (open_or_create
,name
,sizeof(internal_condition) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate)
,perm)
{}
inline shm_named_condition::shm_named_condition(open_only_t, const wchar_t *name)
: m_shmem (open_only
,name
,read_write
,0
,construct_func_t(DoOpen))
{}
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline void shm_named_condition::dont_close_on_destruction()
{ interprocess_tester::dont_close_on_destruction(m_shmem); }
@@ -215,19 +315,27 @@ template <typename L, typename Pr>
inline void shm_named_condition::wait(L& lock, Pr pred)
{ this->internal_cond().wait(lock, pred); }
template <typename L>
template <typename L, typename TimePoint>
inline bool shm_named_condition::timed_wait
(L& lock, const boost::posix_time::ptime &abs_time)
(L& lock, const TimePoint &abs_time)
{ return this->internal_cond().timed_wait(lock, abs_time); }
template <typename L, typename Pr>
template <typename L, typename TimePoint, typename Pr>
inline bool shm_named_condition::timed_wait
(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
(L& lock, const TimePoint &abs_time, Pr pred)
{ return this->internal_cond().timed_wait(lock, abs_time, pred); }
inline bool shm_named_condition::remove(const char *name)
{ return shared_memory_object::remove(name); }
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline bool shm_named_condition::remove(const wchar_t *name)
{ return shared_memory_object::remove(name); }
#endif
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
} //namespace ipcdetail

View File

@@ -21,6 +21,8 @@
#include <boost/interprocess/detail/config_begin.hpp>
#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>
@@ -28,7 +30,6 @@
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/sync/interprocess_condition.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/permissions.hpp>
@@ -61,8 +62,9 @@ class shm_named_condition_any
public:
//!Creates a global condition with a name.
//!If the condition can't be created throws interprocess_exception
shm_named_condition_any(create_only_t create_only, const char *name, const permissions &perm = permissions())
: m_shmem (create_only
template <class CharT>
shm_named_condition_any(create_only_t, const CharT *name, const permissions &perm = permissions())
: m_shmem (create_only_t()
,name
,sizeof(internal_condition) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -78,8 +80,9 @@ class shm_named_condition_any
//!If the condition is already created, this call is equivalent
//!shm_named_condition_any(open_only_t, ... )
//!Does not throw
shm_named_condition_any(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions())
: m_shmem (open_or_create
template <class CharT>
shm_named_condition_any(open_or_create_t, const CharT *name, const permissions &perm = permissions())
: m_shmem (open_or_create_t()
,name
,sizeof(internal_condition) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -92,8 +95,9 @@ class shm_named_condition_any
//!Opens a global condition with a name if that condition is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_condition_any(open_only_t open_only, const char *name)
: m_shmem (open_only
template <class CharT>
shm_named_condition_any(open_only_t, const CharT *name)
: m_shmem (open_only_t()
,name
,read_write
,0
@@ -137,20 +141,45 @@ class shm_named_condition_any
//!this->notify_one() or this->notify_all(), or until time abs_time is reached,
//!and then reacquires the lock.
//!Returns: false if time abs_time is reached, otherwise true.
template <typename L>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time)
template <typename L, typename TimePoint>
bool timed_wait(L& lock, const TimePoint &abs_time)
{ return this->internal_cond().timed_wait(lock, abs_time); }
//!The same as: while (!pred()) {
//! if (!timed_wait(lock, abs_time)) return pred();
//! } return true;
template <typename L, typename Pr>
bool timed_wait(L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
template <typename L, typename TimePoint, typename Pr>
bool timed_wait(L& lock, const TimePoint &abs_time, Pr pred)
{ return this->internal_cond().timed_wait(lock, abs_time, pred); }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface.
template <typename L, class TimePoint>
cv_status wait_until(L& lock, const TimePoint &abs_time)
{ return this->timed_wait(lock, abs_time) ? cv_status::no_timeout : cv_status::timeout; }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface.
template <typename L, class TimePoint, typename Pr>
bool wait_until(L& lock, const TimePoint &abs_time, Pr pred)
{ return this->timed_wait(lock, abs_time, pred); }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface and uses relative timeouts.
template <typename L, class Duration>
cv_status wait_for(L& lock, const Duration &dur)
{ return this->wait_until(lock, ipcdetail::duration_to_ustime(dur)); }
//!Same as `timed_wait`, but this function is modeled after the
//!standard library interface and uses relative timeouts
template <typename L, class Duration, typename Pr>
bool wait_for(L& lock, const Duration &dur, Pr pred)
{ return this->wait_until(lock, ipcdetail::duration_to_ustime(dur), pred); }
//!Erases a named condition from the system.
//!Returns false on error. Never throws.
static bool remove(const char *name)
template <class CharT>
static bool remove(const CharT *name)
{ return shared_memory_object::remove(name); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)

View File

@@ -25,7 +25,6 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/interprocess_tester.hpp>
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
@@ -58,7 +57,7 @@ class shm_named_mutex
public:
//!Creates a global interprocess_mutex with a name.
//!Throws interprocess_exception on error.
shm_named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
shm_named_mutex(create_only_t, const char *name, const permissions &perm = permissions());
//!Opens or creates a global mutex with a name.
//!If the mutex is created, this call is equivalent to
@@ -66,12 +65,33 @@ class shm_named_mutex
//!If the mutex is already created, this call is equivalent
//!shm_named_mutex(open_only_t, ... )
//!Does not throw
shm_named_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
shm_named_mutex(open_or_create_t, const char *name, const permissions &perm = permissions());
//!Opens a global mutex with a name if that mutex is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_mutex(open_only_t open_only, const char *name);
shm_named_mutex(open_only_t, const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Creates a global interprocess_mutex with a name.
//!Throws interprocess_exception on error.
shm_named_mutex(create_only_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens or creates a global mutex with a name.
//!If the mutex is created, this call is equivalent to
//!shm_named_mutex(create_only_t, ... )
//!If the mutex is already created, this call is equivalent
//!shm_named_mutex(open_only_t, ... )
//!Does not throw
shm_named_mutex(open_or_create_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens a global mutex with a name if that mutex is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_mutex(open_only_t, const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Destroys *this and indicates that the calling process is finished using
//!the resource. The destructor function will deallocate
@@ -97,12 +117,27 @@ class shm_named_mutex
//!Tries to lock the interprocess_mutex until time abs_time,
//!Returns false when timeout expires, returns true when locks.
//!Throws interprocess_exception if a severe error is found
bool timed_lock(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_lock(const TimePoint &abs_time);
template<class TimePoint> bool try_lock_until(const TimePoint &abs_time)
{ return this->timed_lock(abs_time); }
template<class Duration> bool try_lock_for(const Duration &dur)
{ return this->timed_lock(duration_to_ustime(dur)); }
//!Erases a named mutex from the system.
//!Returns false on error. Never throws.
static bool remove(const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Erases a named mutex from the system.
//!Returns false on error. Never throws.
static bool remove(const wchar_t *name);
#endif
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
typedef interprocess_mutex internal_mutex_type;
interprocess_mutex &internal_mutex()
@@ -126,7 +161,7 @@ inline shm_named_mutex::~shm_named_mutex()
{}
inline shm_named_mutex::shm_named_mutex(create_only_t, const char *name, const permissions &perm)
: m_shmem (create_only
: m_shmem (create_only_t()
,name
,sizeof(interprocess_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -137,7 +172,7 @@ inline shm_named_mutex::shm_named_mutex(create_only_t, const char *name, const p
{}
inline shm_named_mutex::shm_named_mutex(open_or_create_t, const char *name, const permissions &perm)
: m_shmem (open_or_create
: m_shmem (open_or_create_t()
,name
,sizeof(interprocess_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -148,13 +183,47 @@ inline shm_named_mutex::shm_named_mutex(open_or_create_t, const char *name, cons
{}
inline shm_named_mutex::shm_named_mutex(open_only_t, const char *name)
: m_shmem (open_only
: m_shmem (open_only_t()
,name
,read_write
,0
,construct_func_t(ipcdetail::DoOpen))
{}
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline shm_named_mutex::shm_named_mutex(create_only_t, const wchar_t *name, const permissions &perm)
: m_shmem (create_only_t()
,name
,sizeof(interprocess_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoCreate)
,perm)
{}
inline shm_named_mutex::shm_named_mutex(open_or_create_t, const wchar_t *name, const permissions &perm)
: m_shmem (open_or_create_t()
,name
,sizeof(interprocess_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoOpenOrCreate)
,perm)
{}
inline shm_named_mutex::shm_named_mutex(open_only_t, const wchar_t *name)
: m_shmem (open_only_t()
,name
,read_write
,0
,construct_func_t(ipcdetail::DoOpen))
{}
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline void shm_named_mutex::lock()
{ this->internal_mutex().lock(); }
@@ -164,12 +233,20 @@ inline void shm_named_mutex::unlock()
inline bool shm_named_mutex::try_lock()
{ return this->internal_mutex().try_lock(); }
inline bool shm_named_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool shm_named_mutex::timed_lock(const TimePoint &abs_time)
{ return this->internal_mutex().timed_lock(abs_time); }
inline bool shm_named_mutex::remove(const char *name)
{ return shared_memory_object::remove(name); }
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline bool shm_named_mutex::remove(const wchar_t *name)
{ return shared_memory_object::remove(name); }
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
} //namespace ipcdetail {

View File

@@ -23,7 +23,6 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
@@ -53,7 +52,7 @@ class shm_named_recursive_mutex
//!Creates a global recursive_mutex with a name.
//!If the recursive_mutex can't be created throws interprocess_exception
shm_named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
shm_named_recursive_mutex(create_only_t, const char *name, const permissions &perm = permissions());
//!Opens or creates a global recursive_mutex with a name.
//!If the recursive_mutex is created, this call is equivalent to
@@ -61,12 +60,33 @@ class shm_named_recursive_mutex
//!If the recursive_mutex is already created, this call is equivalent
//!shm_named_recursive_mutex(open_only_t, ... )
//!Does not throw
shm_named_recursive_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
shm_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm = permissions());
//!Opens a global recursive_mutex with a name if that recursive_mutex is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_recursive_mutex(open_only_t open_only, const char *name);
shm_named_recursive_mutex(open_only_t, const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Creates a global recursive_mutex with a name.
//!If the recursive_mutex can't be created throws interprocess_exception
shm_named_recursive_mutex(create_only_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens or creates a global recursive_mutex with a name.
//!If the recursive_mutex is created, this call is equivalent to
//!shm_named_recursive_mutex(create_only_t, ... )
//!If the recursive_mutex is already created, this call is equivalent
//!shm_named_recursive_mutex(open_only_t, ... )
//!Does not throw
shm_named_recursive_mutex(open_or_create_t, const wchar_t *name, const permissions &perm = permissions());
//!Opens a global recursive_mutex with a name if that recursive_mutex is previously
//!created. If it is not previously created this function throws
//!interprocess_exception.
shm_named_recursive_mutex(open_only_t, const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Destroys *this and indicates that the calling process is finished using
//!the resource. The destructor function will deallocate
@@ -92,12 +112,27 @@ class shm_named_recursive_mutex
//!Tries to lock the shm_named_recursive_mutex until time abs_time,
//!Returns false when timeout expires, returns true when locks.
//!Throws interprocess_exception if a severe error is found
bool timed_lock(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_lock(const TimePoint &abs_time);
template<class TimePoint> bool try_lock_until(const TimePoint &abs_time)
{ return this->timed_lock(abs_time); }
template<class Duration> bool try_lock_for(const Duration &dur)
{ return this->timed_lock(duration_to_ustime(dur)); }
//!Erases a named recursive mutex
//!from the system
static bool remove(const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Erases a named recursive mutex
//!from the system
static bool remove(const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
friend class interprocess_tester;
@@ -118,7 +153,7 @@ inline void shm_named_recursive_mutex::dont_close_on_destruction()
{ interprocess_tester::dont_close_on_destruction(m_shmem); }
inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const char *name, const permissions &perm)
: m_shmem (create_only
: m_shmem (create_only_t()
,name
,sizeof(interprocess_recursive_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -129,7 +164,7 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const
{}
inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm)
: m_shmem (open_or_create
: m_shmem (open_or_create_t()
,name
,sizeof(interprocess_recursive_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -140,13 +175,47 @@ inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, co
{}
inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_only_t, const char *name)
: m_shmem (open_only
: m_shmem (open_only_t()
,name
,read_write
,0
,construct_func_t(DoOpen))
{}
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline shm_named_recursive_mutex::shm_named_recursive_mutex(create_only_t, const wchar_t *name, const permissions &perm)
: m_shmem (create_only_t()
,name
,sizeof(interprocess_recursive_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate)
,perm)
{}
inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_or_create_t, const wchar_t *name, const permissions &perm)
: m_shmem (open_or_create_t()
,name
,sizeof(interprocess_recursive_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate)
,perm)
{}
inline shm_named_recursive_mutex::shm_named_recursive_mutex(open_only_t, const wchar_t *name)
: m_shmem (open_only_t()
,name
,read_write
,0
,construct_func_t(DoOpen))
{}
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline void shm_named_recursive_mutex::lock()
{ this->mutex()->lock(); }
@@ -156,12 +225,20 @@ inline void shm_named_recursive_mutex::unlock()
inline bool shm_named_recursive_mutex::try_lock()
{ return this->mutex()->try_lock(); }
inline bool shm_named_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool shm_named_recursive_mutex::timed_lock(const TimePoint &abs_time)
{ return this->mutex()->timed_lock(abs_time); }
inline bool shm_named_recursive_mutex::remove(const char *name)
{ return shared_memory_object::remove(name); }
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline bool shm_named_recursive_mutex::remove(const wchar_t *name)
{ return shared_memory_object::remove(name); }
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
} //namespace ipcdetail {
} //namespace interprocess {
} //namespace boost {

View File

@@ -25,7 +25,6 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/interprocess_tester.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
@@ -52,15 +51,31 @@ class shm_named_semaphore
shm_named_semaphore(open_only_t, const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
shm_named_semaphore(create_only_t, const wchar_t *name, unsigned int initialCount, const permissions &perm = permissions());
shm_named_semaphore(open_or_create_t, const wchar_t *name, unsigned int initialCount, const permissions &perm = permissions());
shm_named_semaphore(open_only_t, const wchar_t *name);
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
~shm_named_semaphore();
void post();
void wait();
bool try_wait();
bool timed_wait(const boost::posix_time::ptime &abs_time);
template<class TimePoint> bool timed_wait(const TimePoint &abs_time);
static bool remove(const char *name);
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
static bool remove(const wchar_t *name);
#endif
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
friend class interprocess_tester;
@@ -71,7 +86,7 @@ class shm_named_semaphore
typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
open_create_impl_t m_shmem;
typedef named_creation_functor<interprocess_semaphore, int> construct_func_t;
typedef named_creation_functor<interprocess_semaphore, unsigned> construct_func_t;
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
@@ -114,6 +129,43 @@ inline shm_named_semaphore::shm_named_semaphore
,construct_func_t(DoOpen, 0))
{}
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline shm_named_semaphore::shm_named_semaphore
(create_only_t, const wchar_t *name, unsigned int initialCount, const permissions &perm)
: m_shmem (create_only
,name
,sizeof(interprocess_semaphore) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate, initialCount)
,perm)
{}
inline shm_named_semaphore::shm_named_semaphore
(open_or_create_t, const wchar_t *name, unsigned int initialCount, const permissions &perm)
: m_shmem (open_or_create
,name
,sizeof(interprocess_semaphore) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate, initialCount)
,perm)
{}
inline shm_named_semaphore::shm_named_semaphore
(open_only_t, const wchar_t *name)
: m_shmem (open_only
,name
,read_write
,0
,construct_func_t(DoOpen, 0))
{}
#endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline void shm_named_semaphore::post()
{ semaphore()->post(); }
@@ -123,12 +175,20 @@ inline void shm_named_semaphore::wait()
inline bool shm_named_semaphore::try_wait()
{ return semaphore()->try_wait(); }
inline bool shm_named_semaphore::timed_wait(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool shm_named_semaphore::timed_wait(const TimePoint &abs_time)
{ return semaphore()->timed_wait(abs_time); }
inline bool shm_named_semaphore::remove(const char *name)
{ return shared_memory_object::remove(name); }
#if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES) || defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
inline bool shm_named_semaphore::remove(const wchar_t *name)
{ return shared_memory_object::remove(name); }
#endif
} //namespace ipcdetail {
} //namespace interprocess {
} //namespace boost {

View File

@@ -26,7 +26,6 @@
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/sync/shm/named_creation_functor.hpp>
#include <boost/interprocess/permissions.hpp>
@@ -58,20 +57,20 @@ class named_upgradable_mutex
//!Creates a global upgradable mutex with a name.
//!If the upgradable mutex can't be created throws interprocess_exception
named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions());
named_upgradable_mutex(create_only_t, const char *name, const permissions &perm = permissions());
//!Opens or creates a global upgradable mutex with a name, and an initial count.
//!If the upgradable mutex is created, this call is equivalent to
//!named_upgradable_mutex(create_only_t, ...)
//!If the upgradable mutex is already created, this call is equivalent to
//!named_upgradable_mutex(open_only_t, ... ).
named_upgradable_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions());
named_upgradable_mutex(open_or_create_t, const char *name, const permissions &perm = permissions());
//!Opens a global upgradable mutex with a name if that upgradable mutex
//!is previously.
//!created. If it is not previously created this function throws
//!interprocess_exception.
named_upgradable_mutex(open_only_t open_only, const char *name);
named_upgradable_mutex(open_only_t, const char *name);
//!Destroys *this and indicates that the calling process is finished using
//!the resource. The destructor function will deallocate
@@ -102,7 +101,8 @@ class named_upgradable_mutex
//! upgradable ownership of the mutex or abs_time is reached.
//!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
//!Throws: interprocess_exception on error.
bool timed_lock(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_lock(const TimePoint &abs_time);
//!Precondition: The thread must have exclusive ownership of the mutex.
//!Effects: The calling thread releases the exclusive ownership of the mutex.
@@ -130,7 +130,8 @@ class named_upgradable_mutex
//! ownership of the mutex or abs_time is reached.
//!Returns: If acquires sharable ownership, returns true. Otherwise returns false.
//!Throws: interprocess_exception on error.
bool timed_lock_sharable(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_lock_sharable(const TimePoint &abs_time);
//!Precondition: The thread must have sharable ownership of the mutex.
//!Effects: The calling thread releases the sharable ownership of the mutex.
@@ -158,7 +159,8 @@ class named_upgradable_mutex
//! ownership of the mutex or abs_time is reached.
//!Returns: If acquires upgradable ownership, returns true. Otherwise returns false.
//!Throws: interprocess_exception on error.
bool timed_lock_upgradable(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_lock_upgradable(const TimePoint &abs_time);
//!Precondition: The thread must have upgradable ownership of the mutex.
//!Effects: The calling thread releases the upgradable ownership of the mutex.
@@ -209,7 +211,8 @@ class named_upgradable_mutex
//! will maintain upgradable ownership.
//!Returns: If acquires exclusive ownership, returns true. Otherwise returns false.
//!Throws: An exception derived from interprocess_exception on error.
bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &abs_time);
template<class TimePoint>
bool timed_unlock_upgradable_and_lock(const TimePoint &abs_time);
//!Precondition: The thread must have sharable ownership of the mutex.
//!Effects: The thread atomically releases sharable ownership and tries to acquire
@@ -246,7 +249,7 @@ inline named_upgradable_mutex::~named_upgradable_mutex()
inline named_upgradable_mutex::named_upgradable_mutex
(create_only_t, const char *name, const permissions &perm)
: m_shmem (create_only
: m_shmem (create_only_t()
,name
,sizeof(interprocess_upgradable_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -258,7 +261,7 @@ inline named_upgradable_mutex::named_upgradable_mutex
inline named_upgradable_mutex::named_upgradable_mutex
(open_or_create_t, const char *name, const permissions &perm)
: m_shmem (open_or_create
: m_shmem (open_or_create_t()
,name
,sizeof(interprocess_upgradable_mutex) +
open_create_impl_t::ManagedOpenOrCreateUserOffset
@@ -270,7 +273,7 @@ inline named_upgradable_mutex::named_upgradable_mutex
inline named_upgradable_mutex::named_upgradable_mutex
(open_only_t, const char *name)
: m_shmem (open_only
: m_shmem (open_only_t()
,name
,read_write
,0
@@ -289,8 +292,8 @@ inline void named_upgradable_mutex::unlock()
inline bool named_upgradable_mutex::try_lock()
{ return this->mutex()->try_lock(); }
inline bool named_upgradable_mutex::timed_lock
(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool named_upgradable_mutex::timed_lock(const TimePoint &abs_time)
{ return this->mutex()->timed_lock(abs_time); }
inline void named_upgradable_mutex::lock_upgradable()
@@ -302,8 +305,8 @@ inline void named_upgradable_mutex::unlock_upgradable()
inline bool named_upgradable_mutex::try_lock_upgradable()
{ return this->mutex()->try_lock_upgradable(); }
inline bool named_upgradable_mutex::timed_lock_upgradable
(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool named_upgradable_mutex::timed_lock_upgradable(const TimePoint &abs_time)
{ return this->mutex()->timed_lock_upgradable(abs_time); }
inline void named_upgradable_mutex::lock_sharable()
@@ -315,8 +318,8 @@ inline void named_upgradable_mutex::unlock_sharable()
inline bool named_upgradable_mutex::try_lock_sharable()
{ return this->mutex()->try_lock_sharable(); }
inline bool named_upgradable_mutex::timed_lock_sharable
(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool named_upgradable_mutex::timed_lock_sharable(const TimePoint &abs_time)
{ return this->mutex()->timed_lock_sharable(abs_time); }
inline void named_upgradable_mutex::unlock_and_lock_upgradable()
@@ -334,8 +337,8 @@ inline void named_upgradable_mutex::unlock_upgradable_and_lock()
inline bool named_upgradable_mutex::try_unlock_upgradable_and_lock()
{ return this->mutex()->try_unlock_upgradable_and_lock(); }
inline bool named_upgradable_mutex::timed_unlock_upgradable_and_lock
(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool named_upgradable_mutex::timed_unlock_upgradable_and_lock(const TimePoint &abs_time)
{ return this->mutex()->timed_unlock_upgradable_and_lock(abs_time); }
inline bool named_upgradable_mutex::try_unlock_sharable_and_lock()