Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:31

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Vicente J. Botet Escriba 2008-2009,2012. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/thread for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #ifndef BOOST_THREAD_POLY_SHARED_LOCKABLE_ADAPTER_HPP
0012 #define BOOST_THREAD_POLY_SHARED_LOCKABLE_ADAPTER_HPP
0013 
0014 #include <boost/thread/poly_lockable_adapter.hpp>
0015 #include <boost/thread/poly_shared_lockable.hpp>
0016 
0017 namespace boost
0018 {
0019 
0020   //[poly_shared_lockable_adapter
0021   template <typename Mutex, typename Base=poly_shared_lockable>
0022   class poly_shared_lockable_adapter: public poly_timed_lockable_adapter<Mutex, Base>
0023   {
0024   public:
0025     typedef Mutex mutex_type;
0026 
0027     void lock_shared()
0028     {
0029       this->mtx().lock_shared();
0030     }
0031     bool try_lock_shared()
0032     {
0033       return this->mtx().try_lock_shared();
0034     }
0035     void unlock_shared()
0036     {
0037       this->mtx().unlock_shared();
0038     }
0039 
0040     bool try_lock_shared_until(chrono::system_clock::time_point const & abs_time)
0041     {
0042       return this->mtx().try_lock_shared_until(abs_time);
0043     }
0044     bool try_lock_shared_until(chrono::steady_clock::time_point const & abs_time)
0045     {
0046       return this->mtx().try_lock_shared_until(abs_time);
0047     }
0048     bool try_lock_shared_for(chrono::nanoseconds const & rel_time)
0049     {
0050       return this->mtx().try_lock_shared_for(rel_time);
0051     }
0052 
0053   };
0054 
0055   //]
0056 
0057   //[poly_upgrade_lockable_adapter
0058   template <typename Mutex, typename Base=poly_shared_lockable>
0059   class poly_upgrade_lockable_adapter: public poly_shared_lockable_adapter<Mutex, Base>
0060   {
0061   public:
0062     typedef Mutex mutex_type;
0063 
0064     void lock_upgrade()
0065     {
0066       this->mtx().lock_upgrade();
0067     }
0068 
0069     bool try_lock_upgrade()
0070     {
0071       return this->mtx().try_lock_upgrade();
0072     }
0073 
0074     void unlock_upgrade()
0075     {
0076       this->mtx().unlock_upgrade();
0077     }
0078 
0079     bool try_lock_upgrade_until(chrono::system_clock::time_point const & abs_time)
0080     {
0081       return this->mtx().try_lock_upgrade_until(abs_time);
0082     }
0083     bool try_lock_upgrade_until(chrono::steady_clock::time_point const & abs_time)
0084     {
0085       return this->mtx().try_lock_upgrade_until(abs_time);
0086     }
0087     bool try_lock_upgrade_for(chrono::nanoseconds const & rel_time)
0088     {
0089       return this->mtx().try_lock_upgrade_for(rel_time);
0090     }
0091 
0092     bool try_unlock_shared_and_lock()
0093     {
0094       return this->mtx().try_unlock_shared_and_lock();
0095     }
0096 
0097     bool try_unlock_shared_and_lock_until(chrono::system_clock::time_point const & abs_time)
0098     {
0099       return this->mtx().try_unlock_shared_and_lock_until(abs_time);
0100     }
0101     bool try_unlock_shared_and_lock_until(chrono::steady_clock::time_point const & abs_time)
0102     {
0103       return this->mtx().try_unlock_shared_and_lock_until(abs_time);
0104     }
0105     bool try_unlock_shared_and_lock_for(chrono::nanoseconds const & rel_time)
0106     {
0107       return this->mtx().try_unlock_shared_and_lock_for(rel_time);
0108     }
0109 
0110     void unlock_and_lock_shared()
0111     {
0112       this->mtx().unlock_and_lock_shared();
0113     }
0114 
0115     bool try_unlock_shared_and_lock_upgrade()
0116     {
0117       return this->mtx().try_unlock_shared_and_lock_upgrade();
0118     }
0119 
0120     bool try_unlock_shared_and_lock_upgrade_until(chrono::system_clock::time_point const & abs_time)
0121     {
0122       return this->mtx().try_unlock_shared_and_lock_upgrade_until(abs_time);
0123     }
0124     bool try_unlock_shared_and_lock_upgrade_until(chrono::steady_clock::time_point const & abs_time)
0125     {
0126       return this->mtx().try_unlock_shared_and_lock_upgrade_until(abs_time);
0127     }
0128     bool try_unlock_shared_and_lock_upgrade_for(chrono::nanoseconds const & rel_time)
0129     {
0130       return this->mtx().try_unlock_shared_and_lock_upgrade_for(rel_time);
0131     }
0132 
0133     void unlock_and_lock_upgrade()
0134     {
0135       this->mtx().unlock_and_lock_upgrade();
0136     }
0137 
0138     void unlock_upgrade_and_lock()
0139     {
0140       this->mtx().unlock_upgrade_and_lock();
0141     }
0142 
0143     bool try_unlock_upgrade_and_lock()
0144     {
0145       return this->mtx().try_unlock_upgrade_and_lock();
0146     }
0147     bool try_unlock_upgrade_and_lock_until(chrono::system_clock::time_point const & abs_time)
0148     {
0149       return this->mtx().try_unlock_upgrade_and_lock_until(abs_time);
0150     }
0151     bool try_unlock_upgrade_and_lock_until(chrono::steady_clock::time_point const & abs_time)
0152     {
0153       return this->mtx().try_unlock_upgrade_and_lock_until(abs_time);
0154     }
0155     bool try_unlock_upgrade_and_lock_for(chrono::nanoseconds const & rel_time)
0156     {
0157       return this->mtx().try_unlock_upgrade_and_lock_for(rel_time);
0158     }
0159 
0160     void unlock_upgrade_and_lock_shared()
0161     {
0162       this->mtx().unlock_upgrade_and_lock_shared();
0163     }
0164 
0165   };
0166 //]
0167 
0168 }
0169 #endif