Boost C++ Libraries

PrevUpHomeNext

Class template upgrade_lock

boost::sync::upgrade_lock — An upgradeable lock scope guard.

Synopsis

// In header: <boost/sync/locks/upgrade_lock.hpp>

template<typename Mutex> 
class upgrade_lock {
public:
  // types
  typedef Mutex mutex_type;

  // construct/copy/destruct
  upgrade_lock() noexcept;
  explicit upgrade_lock(mutex_type &);
  upgrade_lock(mutex_type &, adopt_lock_t) noexcept;
  upgrade_lock(mutex_type &, defer_lock_t) noexcept;
  upgrade_lock(mutex_type &, try_to_lock_t);
  template<typename Time> upgrade_lock(unspecified, Time const &);
  upgrade_lock(upgrade_lock &&) noexcept;
  explicit upgrade_lock(unique_lock< mutex_type > &&);
  upgrade_lock(shared_lock< mutex_type > &&, try_to_lock_t);
  template<typename Time> 
    upgrade_lock(shared_lock< mutex_type > &&, Time const &, unspecified = 0);
  upgrade_lock & operator=(upgrade_lock &&) noexcept;
  upgrade_lock & operator=(unique_lock< mutex_type > &&);
  ~upgrade_lock();

  // public member functions
  void lock();
  bool try_lock();
  template<typename Time> unspecified timed_lock(Time const &);
  template<typename Duration> unspecified try_lock_for(Duration const &);
  template<typename TimePoint> unspecified try_lock_until(TimePoint const &);
  void unlock();
  explicit operator bool() const;
  bool operator!() const noexcept;
  bool owns_lock() const noexcept;
  mutex_type * mutex() const noexcept;
  mutex_type * release() noexcept;
  void swap(upgrade_lock &) noexcept;
};

Description

A unique lock scope guard.

upgrade_lock public construct/copy/destruct

  1. upgrade_lock() noexcept;
  2. explicit upgrade_lock(mutex_type & m);
  3. upgrade_lock(mutex_type & m, adopt_lock_t) noexcept;
  4. upgrade_lock(mutex_type & m, defer_lock_t) noexcept;
  5. upgrade_lock(mutex_type & m, try_to_lock_t);
  6. template<typename Time> upgrade_lock(unspecified m, Time const & t);
  7. upgrade_lock(upgrade_lock && that) noexcept;
  8. explicit upgrade_lock(unique_lock< mutex_type > && that);
  9. upgrade_lock(shared_lock< mutex_type > && sl, try_to_lock_t);
  10. template<typename Time> 
      upgrade_lock(shared_lock< mutex_type > && sl, Time const & t, 
                   unspecified = 0);
  11. upgrade_lock & operator=(upgrade_lock && that) noexcept;
  12. upgrade_lock & operator=(unique_lock< mutex_type > && that);
  13. ~upgrade_lock();

upgrade_lock public member functions

  1. void lock();
  2. bool try_lock();
  3. template<typename Time> unspecified timed_lock(Time const & time);
  4. template<typename Duration> 
      unspecified try_lock_for(Duration const & rel_time);
  5. template<typename TimePoint> 
      unspecified try_lock_until(TimePoint const & abs_time);
  6. void unlock();
  7. explicit operator bool() const;
  8. bool operator!() const noexcept;
  9. bool owns_lock() const noexcept;
  10. mutex_type * mutex() const noexcept;
  11. mutex_type * release() noexcept;
  12. void swap(upgrade_lock & that) noexcept;

PrevUpHomeNext