Changeset d350175 in mainline for uspace/lib/cpp/include/impl/mutex.hpp
- Timestamp:
- 2018-07-05T21:41:20Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2be40c81
- Parents:
- da6bcc0
- git-author:
- Dzejrou <dzejrou@…> (2018-03-29 16:04:53)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/mutex.hpp
rda6bcc0 rd350175 202 202 */ 203 203 204 // TODO: implement 205 class shared_timed_mutex; 204 class shared_timed_mutex 205 { 206 public: 207 shared_timed_mutex() noexcept; 208 ~shared_timed_mutex(); 209 210 shared_timed_mutex(const shared_timed_mutex&) = delete; 211 shared_timed_mutex& operator=(const shared_timed_mutex&) = delete; 212 213 void lock(); 214 bool try_lock(); 215 void unlock(); 216 217 template<class Rep, class Period> 218 bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) 219 { 220 auto time = aux::threading::time::convert(rel_time); 221 222 return aux::threading::shared_mutex::try_lock_for(time); 223 } 224 225 template<class Clock, class Duration> 226 bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) 227 { 228 auto dur = (abs_time - Clock::now()); 229 auto time = aux::threading::time::convert(dur); 230 231 return aux::threading::shared_mutex::try_lock_for(time); 232 } 233 234 void lock_shared(); 235 bool try_lock_shared(); 236 void unlock_shared(); 237 238 template<class Rep, class Period> 239 bool try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time) 240 { 241 auto time = aux::threading::time::convert(rel_time); 242 243 return aux::threading::shared_mutex::try_lock_shared_for(time); 244 } 245 246 template<class Clock, class Duration> 247 bool try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time) 248 { 249 auto dur = (abs_time - Clock::now()); 250 auto time = aux::threading::time::convert(dur); 251 252 return aux::threading::shared_mutex::try_lock_shared_for(time); 253 } 254 255 using native_handle_type = aux::shared_mutex_t*; 256 native_handle_type native_handle(); 257 258 private: 259 aux::shared_mutex_t mtx_; 260 }; 206 261 207 262 struct defer_lock_t
Note:
See TracChangeset
for help on using the changeset viewer.