PageRenderTime 25ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/signals2/detail/unique_lock.hpp

http://hadesmem.googlecode.com/
C++ Header | 42 lines | 28 code | 5 blank | 9 comment | 0 complexity | 305a935b5693bfe2060b086204f7436d MD5 | raw file
 1/*
 2  Provides a basic subset of boost::unique_lock functionality.  Provided only because
 3  including boost/thread/locks.hpp requires linking to thread library
 4*/
 5// Copyright Frank Mori Hess 2008.
 6// Distributed under the Boost Software License, Version
 7// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 8// http://www.boost.org/LICENSE_1_0.txt)
 9
10// See http://www.boost.org/libs/signals2 for library home page.
11
12#ifndef BOOST_SIGNALS2_UNIQUE_LOCK_HPP
13#define BOOST_SIGNALS2_UNIQUE_LOCK_HPP
14
15#include <boost/noncopyable.hpp>
16
17namespace boost
18{
19  namespace signals2
20  {
21    namespace detail
22    {
23      template<typename Mutex>
24      class unique_lock: public noncopyable
25      {
26      public:
27        unique_lock(Mutex &m): _mutex(m)
28        {
29          _mutex.lock();
30        }
31        ~unique_lock()
32        {
33          _mutex.unlock();
34        }
35      private:
36        Mutex &_mutex;
37      };
38    } // namespace detail
39  } // namespace signals2
40} // namespace boost
41
42#endif  // BOOST_SIGNALS2_UNIQUE_LOCK_HPP