]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/interprocess/sync/upgradable_lock.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / interprocess / sync / upgradable_lock.hpp
index d0677516706c7d7b1feba2f4eecbb4e0e2428b39..787cf16e1ffd6a3387e8d966c555b2347af5db5a 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/move/utility_core.hpp>
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 
 //!\file
 //!Describes the upgradable_lock class that serves to acquire the upgradable
@@ -67,7 +66,7 @@ class upgradable_lock
 
    //!Effects: Default constructs a upgradable_lock.
    //!Postconditions: owns() == false and mutex() == 0.
-   upgradable_lock()
+   upgradable_lock() BOOST_NOEXCEPT
       : mp_mutex(0), m_locked(false)
    {}
 
@@ -109,7 +108,8 @@ class upgradable_lock
    //!   handles recursive locking depends upon the mutex. If the mutex_type
    //!   does not support timed_lock_upgradable, this constructor will fail
    //!   at compile time if instantiated, but otherwise have no effect.
-   upgradable_lock(mutex_type& m, const boost::posix_time::ptime& abs_time)
+   template<class TimePoint>
+   upgradable_lock(mutex_type& m, const TimePoint& abs_time)
       : mp_mutex(&m), m_locked(false)
    {  m_locked = mp_mutex->timed_lock_upgradable(abs_time);  }
 
@@ -123,7 +123,7 @@ class upgradable_lock
    //!   signature. An non-moved upgradable_lock can be moved with the
    //!   expression: "boost::move(lock);". This constructor does not alter the
    //!   state of the mutex, only potentially who owns it.
-   upgradable_lock(BOOST_RV_REF(upgradable_lock<mutex_type>) upgr)
+   upgradable_lock(BOOST_RV_REF(upgradable_lock<mutex_type>) upgr) BOOST_NOEXCEPT
       : mp_mutex(0), m_locked(upgr.owns())
    {  mp_mutex = upgr.release(); }
 
@@ -184,10 +184,10 @@ class upgradable_lock
    //!Notes: The destructor behavior ensures that the mutex lock is not leaked.
    ~upgradable_lock()
    {
-      try{
+      BOOST_TRY{
          if(m_locked && mp_mutex)   mp_mutex->unlock_upgradable();
       }
-      catch(...){}
+      BOOST_CATCH(...){} BOOST_CATCH_END
    }
 
    //!Effects: If owns(), then unlock_upgradable() is called on mutex().
@@ -243,7 +243,8 @@ class upgradable_lock
    //!   specified time. If the mutex_type does not support
    //!   timed_lock_upgradable(abs_time), this function will fail at compile
    //!   time if instantiated, but otherwise have no effect.
-   bool timed_lock(const boost::posix_time::ptime& abs_time)
+   template<class TimePoint>
+   bool timed_lock(const TimePoint& abs_time)
    {
       if(!mp_mutex || m_locked)
          throw lock_exception();
@@ -266,23 +267,23 @@ class upgradable_lock
 
    //!Effects: Returns true if this scoped_lock has acquired the
    //!referenced mutex.
-   bool owns() const
+   bool owns() const BOOST_NOEXCEPT
    {  return m_locked && mp_mutex;  }
 
    //!Conversion to bool.
    //!Returns owns().
-   operator unspecified_bool_type() const
+   operator unspecified_bool_type() const BOOST_NOEXCEPT
    {  return m_locked? &this_type::m_locked : 0;   }
 
    //!Effects: Returns a pointer to the referenced mutex, or 0 if
    //!there is no mutex to reference.
-   mutex_type* mutex() const
+   mutex_type* mutex() const BOOST_NOEXCEPT
    {  return  mp_mutex;  }
 
    //!Effects: Returns a pointer to the referenced mutex, or 0 if there is no
    //!   mutex to reference.
    //!Postconditions: mutex() == 0 and owns() == false.
-   mutex_type* release()
+   mutex_type* release() BOOST_NOEXCEPT
    {
       mutex_type *mut = mp_mutex;
       mp_mutex = 0;
@@ -292,7 +293,7 @@ class upgradable_lock
 
    //!Effects: Swaps state with moved lock.
    //!Throws: Nothing.
-   void swap(upgradable_lock<mutex_type> &other)
+   void swap(upgradable_lock<mutex_type> &other) BOOST_NOEXCEPT
    {
       (simple_swap)(mp_mutex, other.mp_mutex);
       (simple_swap)(m_locked, other.m_locked);