annotate DEPENDENCIES/generic/include/boost/interprocess/sync/detail/locks.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2012-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/interprocess for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_INTERPROCESS_DETAIL_LOCKS_HPP
Chris@16 12 #define BOOST_INTERPROCESS_DETAIL_LOCKS_HPP
Chris@16 13
Chris@16 14 #include <boost/interprocess/detail/config_begin.hpp>
Chris@16 15 #include <boost/interprocess/detail/workaround.hpp>
Chris@16 16
Chris@16 17 namespace boost {
Chris@16 18 namespace interprocess {
Chris@16 19 namespace ipcdetail {
Chris@16 20
Chris@16 21 template<class Lock>
Chris@16 22 class internal_mutex_lock
Chris@16 23 {
Chris@16 24 typedef void (internal_mutex_lock::*unspecified_bool_type)();
Chris@16 25 public:
Chris@16 26
Chris@16 27 typedef typename Lock::mutex_type::internal_mutex_type mutex_type;
Chris@16 28
Chris@16 29
Chris@16 30 internal_mutex_lock(Lock &l)
Chris@16 31 : l_(l)
Chris@16 32 {}
Chris@16 33
Chris@16 34 mutex_type* mutex() const
Chris@16 35 { return l_ ? &l_.mutex()->internal_mutex() : 0; }
Chris@16 36
Chris@16 37 void lock() { l_.lock(); }
Chris@16 38
Chris@16 39 void unlock() { l_.unlock(); }
Chris@16 40
Chris@16 41 operator unspecified_bool_type() const
Chris@16 42 { return l_ ? &internal_mutex_lock::lock : 0; }
Chris@16 43
Chris@16 44 private:
Chris@16 45 Lock &l_;
Chris@16 46 };
Chris@16 47
Chris@16 48 template <class Lock>
Chris@16 49 class lock_inverter
Chris@16 50 {
Chris@16 51 Lock &l_;
Chris@16 52 public:
Chris@16 53 lock_inverter(Lock &l)
Chris@16 54 : l_(l)
Chris@16 55 {}
Chris@16 56 void lock() { l_.unlock(); }
Chris@16 57 void unlock() { l_.lock(); }
Chris@16 58 };
Chris@16 59
Chris@16 60 } //namespace ipcdetail
Chris@16 61 } //namespace interprocess
Chris@16 62 } //namespace boost
Chris@16 63
Chris@16 64 #include <boost/interprocess/detail/config_end.hpp>
Chris@16 65
Chris@16 66 #endif //BOOST_INTERPROCESS_DETAIL_LOCKS_HPP