Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/asio/detail/std_mutex.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 // | |
2 // detail/std_mutex.hpp | |
3 // ~~~~~~~~~~~~~~~~~~~~ | |
4 // | |
5 // Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com) | |
6 // | |
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 // | |
10 | |
11 #ifndef BOOST_ASIO_DETAIL_STD_MUTEX_HPP | |
12 #define BOOST_ASIO_DETAIL_STD_MUTEX_HPP | |
13 | |
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) | |
15 # pragma once | |
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) | |
17 | |
18 #include <boost/asio/detail/config.hpp> | |
19 | |
20 #if defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR) | |
21 | |
22 #include <mutex> | |
23 #include <boost/asio/detail/noncopyable.hpp> | |
24 #include <boost/asio/detail/scoped_lock.hpp> | |
25 | |
26 #include <boost/asio/detail/push_options.hpp> | |
27 | |
28 namespace boost { | |
29 namespace asio { | |
30 namespace detail { | |
31 | |
32 class std_event; | |
33 | |
34 class std_mutex | |
35 : private noncopyable | |
36 { | |
37 public: | |
38 typedef boost::asio::detail::scoped_lock<std_mutex> scoped_lock; | |
39 | |
40 // Constructor. | |
41 std_mutex() | |
42 { | |
43 } | |
44 | |
45 // Destructor. | |
46 ~std_mutex() | |
47 { | |
48 } | |
49 | |
50 // Lock the mutex. | |
51 void lock() | |
52 { | |
53 mutex_.lock(); | |
54 } | |
55 | |
56 // Unlock the mutex. | |
57 void unlock() | |
58 { | |
59 mutex_.unlock(); | |
60 } | |
61 | |
62 private: | |
63 friend class std_event; | |
64 std::mutex mutex_; | |
65 }; | |
66 | |
67 } // namespace detail | |
68 } // namespace asio | |
69 } // namespace boost | |
70 | |
71 #include <boost/asio/detail/pop_options.hpp> | |
72 | |
73 #endif // defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR) | |
74 | |
75 #endif // BOOST_ASIO_DETAIL_STD_MUTEX_HPP |