From 30d5005ac627b36c122e69c86cf518aaaadd92ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 2 Jun 2020 14:51:08 +0200 Subject: [PATCH] Use is_pos_infinity() instead of pos_inf due to some old MinGW compilers ICEing on the conversion from the special value to ptime --- include/boost/interprocess/ipc/message_queue.hpp | 4 ++-- include/boost/interprocess/sync/detail/locks.hpp | 10 +++++----- include/boost/interprocess/sync/posix/condition.hpp | 4 ++-- include/boost/interprocess/sync/posix/mutex.hpp | 2 +- .../boost/interprocess/sync/posix/recursive_mutex.hpp | 2 +- .../interprocess/sync/posix/semaphore_wrapper.hpp | 2 +- include/boost/interprocess/sync/spin/condition.hpp | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/boost/interprocess/ipc/message_queue.hpp b/include/boost/interprocess/ipc/message_queue.hpp index da45ad4..6b17665 100644 --- a/include/boost/interprocess/ipc/message_queue.hpp +++ b/include/boost/interprocess/ipc/message_queue.hpp @@ -709,7 +709,7 @@ inline bool message_queue_t::timed_send (const void *buffer, size_type buffer_size ,unsigned int priority, const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->send(buffer, buffer_size, priority); return true; } @@ -834,7 +834,7 @@ inline bool size_type &recvd_size, unsigned int &priority, const boost::posix_time::ptime &abs_time) { - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->receive(buffer, buffer_size, recvd_size, priority); return true; } diff --git a/include/boost/interprocess/sync/detail/locks.hpp b/include/boost/interprocess/sync/detail/locks.hpp index 34f2f17..9ad47d2 100644 --- a/include/boost/interprocess/sync/detail/locks.hpp +++ b/include/boost/interprocess/sync/detail/locks.hpp @@ -36,11 +36,11 @@ class internal_mutex_lock typedef typename Lock::mutex_type::internal_mutex_type mutex_type; - internal_mutex_lock(Lock &l) + BOOST_INTERPROCESS_FORCEINLINE internal_mutex_lock(Lock &l) : l_(l) {} - mutex_type* mutex() const + BOOST_INTERPROCESS_FORCEINLINE mutex_type* mutex() const { return l_ ? &l_.mutex()->internal_mutex() : 0; } BOOST_INTERPROCESS_FORCEINLINE void lock() { l_.lock(); } @@ -59,7 +59,7 @@ class lock_inverter { Lock &l_; public: - lock_inverter(Lock &l) + BOOST_INTERPROCESS_FORCEINLINE lock_inverter(Lock &l) : l_(l) {} @@ -74,7 +74,7 @@ class lock_to_sharable Lock &l_; public: - explicit lock_to_sharable(Lock &l) + BOOST_INTERPROCESS_FORCEINLINE explicit lock_to_sharable(Lock &l) : l_(l) {} @@ -91,7 +91,7 @@ class lock_to_wait Lock &l_; public: - explicit lock_to_wait(Lock &l) + BOOST_INTERPROCESS_FORCEINLINE explicit lock_to_wait(Lock &l) : l_(l) {} BOOST_INTERPROCESS_FORCEINLINE void lock() { l_.wait(); } diff --git a/include/boost/interprocess/sync/posix/condition.hpp b/include/boost/interprocess/sync/posix/condition.hpp index 5372d96..4773acf 100644 --- a/include/boost/interprocess/sync/posix/condition.hpp +++ b/include/boost/interprocess/sync/posix/condition.hpp @@ -90,7 +90,7 @@ class posix_condition if (!lock) throw lock_exception(); //Posix does not support infinity absolute time so handle it here - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->wait(lock); return true; } @@ -106,7 +106,7 @@ class posix_condition if (!lock) throw lock_exception(); //Posix does not support infinity absolute time so handle it here - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->wait(lock, pred); return true; } diff --git a/include/boost/interprocess/sync/posix/mutex.hpp b/include/boost/interprocess/sync/posix/mutex.hpp index 70adc23..0a2c6f0 100644 --- a/include/boost/interprocess/sync/posix/mutex.hpp +++ b/include/boost/interprocess/sync/posix/mutex.hpp @@ -109,7 +109,7 @@ inline bool posix_mutex::timed_lock(const boost::posix_time::ptime &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(abs_time.is_pos_infinity()){ this->lock(); return true; } diff --git a/include/boost/interprocess/sync/posix/recursive_mutex.hpp b/include/boost/interprocess/sync/posix/recursive_mutex.hpp index 9ef4f12..b078a46 100644 --- a/include/boost/interprocess/sync/posix/recursive_mutex.hpp +++ b/include/boost/interprocess/sync/posix/recursive_mutex.hpp @@ -103,7 +103,7 @@ inline bool posix_recursive_mutex::timed_lock(const boost::posix_time::ptime &ab { #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(abs_time.is_pos_infinity()){ this->lock(); return true; } diff --git a/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp b/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp index ca0f519..4afd57b 100644 --- a/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp +++ b/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp @@ -216,7 +216,7 @@ inline bool semaphore_timed_wait(sem_t *handle, const boost::posix_time::ptime & { #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(abs_time.is_pos_infinity()){ semaphore_wait(handle); return true; } diff --git a/include/boost/interprocess/sync/spin/condition.hpp b/include/boost/interprocess/sync/spin/condition.hpp index 1a1878b..af7c65c 100644 --- a/include/boost/interprocess/sync/spin/condition.hpp +++ b/include/boost/interprocess/sync/spin/condition.hpp @@ -52,7 +52,7 @@ class spin_condition if (!lock) throw lock_exception(); //Handle infinity absolute time here to avoid complications in do_timed_wait - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->wait(lock); return true; } @@ -65,7 +65,7 @@ class spin_condition if (!lock) throw lock_exception(); //Handle infinity absolute time here to avoid complications in do_timed_wait - if(abs_time == boost::posix_time::pos_infin){ + if(abs_time.is_pos_infinity()){ this->wait(lock, pred); return true; }