]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/interprocess/test/named_recursive_mutex_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / interprocess / test / named_recursive_mutex_test.cpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/libs/interprocess for documentation.
8 //
9 //////////////////////////////////////////////////////////////////////////////
10
11 #include <boost/interprocess/sync/named_recursive_mutex.hpp>
12 #include <boost/interprocess/sync/scoped_lock.hpp>
13 #include "mutex_test_template.hpp"
14 #include "named_creation_template.hpp"
15 #include "get_process_id_name.hpp"
16 #include <exception>
17
18 #if defined(BOOST_INTERPROCESS_WINDOWS)
19 #include <boost/interprocess/sync/windows/named_recursive_mutex.hpp>
20 #endif
21
22 using namespace boost::interprocess;
23
24
25 template<class NamedRecursiveMutex>
26 int test_named_recursive_mutex()
27 {
28 int ret = 0;
29 BOOST_TRY{
30 NamedRecursiveMutex::remove(test::get_process_id_name());
31 test::test_named_creation< test::named_sync_creation_test_wrapper<NamedRecursiveMutex> >();
32 #if defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES)
33 test::test_named_creation< test::named_sync_creation_test_wrapper_w<NamedRecursiveMutex> >();
34 #endif //defined(BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES)
35 test::test_all_lock< test::named_sync_wrapper<NamedRecursiveMutex> >();
36 test::test_all_mutex<test::named_sync_wrapper<NamedRecursiveMutex> >();
37 test::test_all_recursive_lock<test::named_sync_wrapper<NamedRecursiveMutex> >();
38 }
39 BOOST_CATCH(std::exception &ex){
40 std::cout << ex.what() << std::endl;
41 ret = 1;
42 } BOOST_CATCH_END
43 NamedRecursiveMutex::remove(test::get_process_id_name());
44 return ret;
45 }
46
47 int main()
48 {
49 int ret;
50 #if defined(BOOST_INTERPROCESS_WINDOWS)
51 ret = test_named_recursive_mutex<ipcdetail::winapi_named_recursive_mutex>();
52 if (ret)
53 return ret;
54 #endif
55 ret = test_named_recursive_mutex<named_recursive_mutex>();
56
57 return ret;
58 }