Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:41

0001 /*
0002   Provides a basic subset of boost::unique_lock functionality.  Provided only because
0003   including boost/thread/locks.hpp requires linking to thread library
0004 */
0005 // Copyright Frank Mori Hess 2008.
0006 // Distributed under the Boost Software License, Version
0007 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 // See http://www.boost.org/libs/signals2 for library home page.
0011 
0012 #ifndef BOOST_SIGNALS2_UNIQUE_LOCK_HPP
0013 #define BOOST_SIGNALS2_UNIQUE_LOCK_HPP
0014 
0015 #include <boost/core/noncopyable.hpp>
0016 
0017 namespace boost
0018 {
0019   namespace signals2
0020   {
0021     namespace detail
0022     {
0023       template<typename Mutex>
0024       class unique_lock: public noncopyable
0025       {
0026       public:
0027         unique_lock(Mutex &m): _mutex(m)
0028         {
0029           _mutex.lock();
0030         }
0031         ~unique_lock()
0032         {
0033           _mutex.unlock();
0034         }
0035       private:
0036         Mutex &_mutex;
0037       };
0038     } // namespace detail
0039   } // namespace signals2
0040 } // namespace boost
0041 
0042 #endif  // BOOST_SIGNALS2_UNIQUE_LOCK_HPP