Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / thread / win32 / mutex.hpp
1 #ifndef BOOST_THREAD_WIN32_MUTEX_HPP
2 #define BOOST_THREAD_WIN32_MUTEX_HPP
3 // (C) Copyright 2005-7 Anthony Williams
4 // (C) Copyright 2011-2012 Vicente J. Botet Escriba
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <boost/thread/win32/basic_timed_mutex.hpp>
10 #include <boost/thread/exceptions.hpp>
11 #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
12 #include <boost/thread/lock_types.hpp>
13 #endif
14 #include <boost/thread/detail/delete.hpp>
15
16 #include <boost/config/abi_prefix.hpp>
17
18 namespace boost
19 {
20     namespace detail
21     {
22         typedef ::boost::detail::basic_timed_mutex underlying_mutex;
23     }
24
25     class mutex:
26         public ::boost::detail::underlying_mutex
27     {
28     public:
29         BOOST_THREAD_NO_COPYABLE(mutex)
30         mutex()
31         {
32             initialize();
33         }
34         ~mutex()
35         {
36             destroy();
37         }
38
39 #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
40         typedef unique_lock<mutex> scoped_lock;
41         typedef detail::try_lock_wrapper<mutex> scoped_try_lock;
42 #endif
43     };
44
45     typedef mutex try_mutex;
46
47     class timed_mutex:
48         public ::boost::detail::basic_timed_mutex
49     {
50     public:
51         BOOST_THREAD_NO_COPYABLE(timed_mutex)
52         timed_mutex()
53         {
54             initialize();
55         }
56
57         ~timed_mutex()
58         {
59             destroy();
60         }
61
62 #if defined BOOST_THREAD_PROVIDES_NESTED_LOCKS
63         typedef unique_lock<timed_mutex> scoped_timed_lock;
64         typedef detail::try_lock_wrapper<timed_mutex> scoped_try_lock;
65         typedef scoped_timed_lock scoped_lock;
66 #endif
67     };
68 }
69
70 #include <boost/config/abi_suffix.hpp>
71
72 #endif