annotate DEPENDENCIES/generic/include/boost/thread/poly_shared_lockable_adapter.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Vicente J. Botet Escriba 2008-2009,2012. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/thread for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_THREAD_POLY_SHARED_LOCKABLE_ADAPTER_HPP
Chris@16 12 #define BOOST_THREAD_POLY_SHARED_LOCKABLE_ADAPTER_HPP
Chris@16 13
Chris@16 14 #include <boost/thread/poly_lockable_adapter.hpp>
Chris@16 15 #include <boost/thread/poly_shared_lockable.hpp>
Chris@16 16
Chris@16 17 namespace boost
Chris@16 18 {
Chris@16 19
Chris@16 20 //[shared_lockable_adapter
Chris@16 21 template <typename Mutex, typename Base=poly_shared_lockable>
Chris@16 22 class poly_shared_lockable_adapter: public poly_timed_lockable_adapter<Mutex, Base>
Chris@16 23 {
Chris@16 24 public:
Chris@16 25 typedef Mutex mutex_type;
Chris@16 26
Chris@16 27 void lock_shared()
Chris@16 28 {
Chris@16 29 this->mtx().lock_shared();
Chris@16 30 }
Chris@16 31 bool try_lock_shared()
Chris@16 32 {
Chris@16 33 return this->mtx().try_lock_shared();
Chris@16 34 }
Chris@16 35 void unlock_shared()
Chris@16 36 {
Chris@16 37 this->mtx().unlock_shared();
Chris@16 38 }
Chris@16 39
Chris@16 40 bool try_lock_shared_until(chrono::system_clock::time_point const & abs_time)
Chris@16 41 {
Chris@16 42 return this->mtx().try_lock_shared_until(abs_time);
Chris@16 43 }
Chris@16 44 bool try_lock_shared_until(chrono::steady_clock::time_point const & abs_time)
Chris@16 45 {
Chris@16 46 return this->mtx().try_lock_shared_until(abs_time);
Chris@16 47 }
Chris@16 48 bool try_lock_shared_for(chrono::nanoseconds const & rel_time)
Chris@16 49 {
Chris@16 50 return this->mtx().try_lock_shared_for(rel_time);
Chris@16 51 }
Chris@16 52
Chris@16 53 };
Chris@16 54
Chris@16 55 //]
Chris@16 56
Chris@16 57 //[upgrade_lockable_adapter
Chris@16 58 template <typename Mutex, typename Base=poly_shared_lockable>
Chris@16 59 class upgrade_lockable_adapter: public shared_lockable_adapter<Mutex, Base>
Chris@16 60 {
Chris@16 61 public:
Chris@16 62 typedef Mutex mutex_type;
Chris@16 63
Chris@16 64 void lock_upgrade()
Chris@16 65 {
Chris@16 66 this->mtx().lock_upgrade();
Chris@16 67 }
Chris@16 68
Chris@16 69 bool try_lock_upgrade()
Chris@16 70 {
Chris@16 71 return this->mtx().try_lock_upgrade();
Chris@16 72 }
Chris@16 73
Chris@16 74 void unlock_upgrade()
Chris@16 75 {
Chris@16 76 this->mtx().unlock_upgrade();
Chris@16 77 }
Chris@16 78
Chris@16 79 bool try_lock_upgrade_until(chrono::system_clock::time_point const & abs_time)
Chris@16 80 {
Chris@16 81 return this->mtx().try_lock_upgrade_until(abs_time);
Chris@16 82 }
Chris@16 83 bool try_lock_upgrade_until(chrono::steady_clock::time_point const & abs_time)
Chris@16 84 {
Chris@16 85 return this->mtx().try_lock_upgrade_until(abs_time);
Chris@16 86 }
Chris@16 87 bool try_lock_upgrade_for(chrono::nanoseconds const & rel_time)
Chris@16 88 {
Chris@16 89 return this->mtx().try_lock_upgrade_for(rel_time);
Chris@16 90 }
Chris@16 91
Chris@16 92 bool try_unlock_shared_and_lock()
Chris@16 93 {
Chris@16 94 return this->mtx().try_unlock_shared_and_lock();
Chris@16 95 }
Chris@16 96
Chris@16 97 bool try_unlock_shared_and_lock_until(chrono::system_clock::time_point const & abs_time)
Chris@16 98 {
Chris@16 99 return this->mtx().try_unlock_shared_and_lock_until(abs_time);
Chris@16 100 }
Chris@16 101 bool try_unlock_shared_and_lock_until(chrono::steady_clock::time_point const & abs_time)
Chris@16 102 {
Chris@16 103 return this->mtx().try_unlock_shared_and_lock_until(abs_time);
Chris@16 104 }
Chris@16 105 template <typename Rep, typename Period>
Chris@16 106 bool try_unlock_shared_and_lock_for(chrono::nanoseconds const & rel_time)
Chris@16 107 {
Chris@16 108 return this->mtx().try_unlock_shared_and_lock_for(rel_time);
Chris@16 109 }
Chris@16 110
Chris@16 111 void unlock_and_lock_shared()
Chris@16 112 {
Chris@16 113 this->mtx().unlock_and_lock_shared();
Chris@16 114 }
Chris@16 115
Chris@16 116 bool try_unlock_shared_and_lock_upgrade()
Chris@16 117 {
Chris@16 118 return this->mtx().try_unlock_shared_and_lock_upgrade();
Chris@16 119 }
Chris@16 120
Chris@16 121 bool try_unlock_shared_and_lock_upgrade_until(chrono::system_clock::time_point const & abs_time)
Chris@16 122 {
Chris@16 123 return this->mtx().try_unlock_shared_and_lock_upgrade_until(abs_time);
Chris@16 124 }
Chris@16 125 bool try_unlock_shared_and_lock_upgrade_until(chrono::steady_clock::time_point const & abs_time)
Chris@16 126 {
Chris@16 127 return this->mtx().try_unlock_shared_and_lock_upgrade_until(abs_time);
Chris@16 128 }
Chris@16 129 bool try_unlock_shared_and_lock_upgrade_for(chrono::nanoseconds const & rel_time)
Chris@16 130 {
Chris@16 131 return this->mtx().try_unlock_shared_and_lock_upgrade_for(rel_time);
Chris@16 132 }
Chris@16 133
Chris@16 134 void unlock_and_lock_upgrade()
Chris@16 135 {
Chris@16 136 this->mtx().unlock_and_lock_upgrade();
Chris@16 137 }
Chris@16 138
Chris@16 139 void unlock_upgrade_and_lock()
Chris@16 140 {
Chris@16 141 this->mtx().unlock_upgrade_and_lock();
Chris@16 142 }
Chris@16 143
Chris@16 144 bool try_unlock_upgrade_and_lock()
Chris@16 145 {
Chris@16 146 return this->mtx().try_unlock_upgrade_and_lock();
Chris@16 147 }
Chris@16 148 bool try_unlock_upgrade_and_lock_until(chrono::system_clock::time_point const & abs_time)
Chris@16 149 {
Chris@16 150 return this->mtx().try_unlock_upgrade_and_lock_until(abs_time);
Chris@16 151 }
Chris@16 152 bool try_unlock_upgrade_and_lock_until(chrono::steady_clock::time_point const & abs_time)
Chris@16 153 {
Chris@16 154 return this->mtx().try_unlock_upgrade_and_lock_until(abs_time);
Chris@16 155 }
Chris@16 156 bool try_unlock_upgrade_and_lock_for(chrono::nanoseconds const & rel_time)
Chris@16 157 {
Chris@16 158 return this->mtx().try_unlock_upgrade_and_lock_for(rel_time);
Chris@16 159 }
Chris@16 160
Chris@16 161 void unlock_upgrade_and_lock_shared()
Chris@16 162 {
Chris@16 163 this->mtx().unlock_upgrade_and_lock_shared();
Chris@16 164 }
Chris@16 165
Chris@16 166 };
Chris@16 167 //]
Chris@16 168
Chris@16 169 }
Chris@16 170 #endif