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

@@ -41,10 +41,11 @@
#include <pthread.h>
#include <errno.h>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/sync/posix/ptime_to_timespec.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/sync/posix/timepoint_to_timespec.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/sync/posix/pthread_helpers.hpp>
#include <boost/interprocess/detail/timed_utils.hpp>
#ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS
# include <boost/interprocess/detail/os_thread_functions.hpp>
@@ -69,7 +70,14 @@ class posix_mutex
void lock();
bool try_lock();
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)); }
void unlock();
friend class posix_condition;
@@ -93,28 +101,66 @@ inline posix_mutex::~posix_mutex()
inline void posix_mutex::lock()
{
if (pthread_mutex_lock(&m_mut) != 0)
int res = pthread_mutex_lock(&m_mut);
#ifdef BOOST_INTERPROCESS_POSIX_ROBUST_MUTEXES
if (res == EOWNERDEAD)
{
//We can't inform the application and data might
//corrupted, so be safe and mark the mutex as not recoverable
//so applications can act accordingly.
pthread_mutex_unlock(&m_mut);
throw lock_exception(not_recoverable);
}
else if (res == ENOTRECOVERABLE)
throw lock_exception(not_recoverable);
#endif
if (res != 0)
throw lock_exception();
}
inline bool posix_mutex::try_lock()
{
int res = pthread_mutex_trylock(&m_mut);
#ifdef BOOST_INTERPROCESS_POSIX_ROBUST_MUTEXES
if (res == EOWNERDEAD)
{
//We can't inform the application and data might
//corrupted, so be safe and mark the mutex as not recoverable
//so applications can act accordingly.
pthread_mutex_unlock(&m_mut);
throw lock_exception(not_recoverable);
}
else if (res == ENOTRECOVERABLE)
throw lock_exception(not_recoverable);
#endif
if (!(res == 0 || res == EBUSY))
throw lock_exception();
return res == 0;
}
inline bool posix_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
template<class TimePoint>
inline bool posix_mutex::timed_lock(const TimePoint &abs_time)
{
#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
//Posix does not support infinity absolute time so handle it here
if(abs_time == boost::posix_time::pos_infin){
if(ipcdetail::is_pos_infinity(abs_time)){
this->lock();
return true;
}
timespec ts = ptime_to_timespec(abs_time);
timespec ts = timepoint_to_timespec(abs_time);
int res = pthread_mutex_timedlock(&m_mut, &ts);
#ifdef BOOST_INTERPROCESS_POSIX_ROBUST_MUTEXES
if (res == EOWNERDEAD)
{
//We can't inform the application and data might
//corrupted, so be safe and mark the mutex as not recoverable
//so applications can act accordingly.
pthread_mutex_unlock(&m_mut);
throw lock_exception(not_recoverable);
}
else if (res == ENOTRECOVERABLE)
throw lock_exception(not_recoverable);
#endif
if (res != 0 && res != ETIMEDOUT)
throw lock_exception();
return res == 0;
@@ -128,8 +174,7 @@ inline bool posix_mutex::timed_lock(const boost::posix_time::ptime &abs_time)
inline void posix_mutex::unlock()
{
int res = 0;
res = pthread_mutex_unlock(&m_mut);
int res = pthread_mutex_unlock(&m_mut);
(void)res;
BOOST_ASSERT(res == 0);
}